Message ID | 4a22986c4685058d2c735d91703ee7d865815bb9.1635237668.git.leonro@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | [rdma-next,v1] RDMA/core: Initialize lock when allocate a rdma_hw_stats structure | expand |
On Tue, Oct 26, 2021 at 11:43:03AM +0300, Leon Romanovsky wrote: > From: Mark Zhang <markzhang@nvidia.com> > > Initialize the rdma_hw_stats "lock" field when do allocation, to fix the > warning below. Then we don't need to initialize it in sysfs, remove it. > drivers/infiniband/core/sysfs.c | 2 -- > drivers/infiniband/core/verbs.c | 1 + > 2 files changed, 1 insertion(+), 2 deletions(-) Applied to for-next Jason
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 8626dfbf2199..a3f84b50c46a 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -911,7 +911,6 @@ alloc_hw_stats_device(struct ib_device *ibdev) if (!data->group.attrs) goto err_free_data; - mutex_init(&stats->lock); data->group.name = "hw_counters"; data->stats = stats; return data; @@ -1018,7 +1017,6 @@ alloc_hw_stats_port(struct ib_port *port, struct attribute_group *group) if (!group->attrs) goto err_free_data; - mutex_init(&stats->lock); group->name = "hw_counters"; data->stats = stats; return data; diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 47cf273d0678..692d5ff657df 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -3002,6 +3002,7 @@ struct rdma_hw_stats *rdma_alloc_hw_stats_struct( stats->descs = descs; stats->num_counters = num_counters; stats->lifespan = msecs_to_jiffies(lifespan); + mutex_init(&stats->lock); return stats;