aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/counters.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2019-07-23 09:57:24 +0300
committerJason Gunthorpe <jgg@mellanox.com>2019-07-25 12:07:14 -0300
commit56594ae1d250f839945cda89d0138eece46dd607 (patch)
tree54f812559bc43ae22cdef3e4ae25aa7dd4df49ca /drivers/infiniband/core/counters.c
parentRDMA/hns: Fix comparison of unsigned long variable 'end' with less than zero (diff)
downloadlinux-dev-56594ae1d250f839945cda89d0138eece46dd607.tar.xz
linux-dev-56594ae1d250f839945cda89d0138eece46dd607.zip
RDMA/core: Annotate destroy of mutex to ensure that it is released as unlocked
While compiled with CONFIG_DEBUG_MUTEXES, the kernel ensures that mutex is not held during destroy. Hence add mutex_destroy() for mutexes used in RDMA modules. Link: https://lore.kernel.org/r/20190723065733.4899-2-leon@kernel.org Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/counters.c')
-rw-r--r--drivers/infiniband/core/counters.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c
index 01faef7bc061..9ed7fce85747 100644
--- a/drivers/infiniband/core/counters.c
+++ b/drivers/infiniband/core/counters.c
@@ -592,7 +592,7 @@ int rdma_counter_get_mode(struct ib_device *dev, u8 port,
void rdma_counter_init(struct ib_device *dev)
{
struct rdma_port_counter *port_counter;
- u32 port;
+ u32 port, i;
if (!dev->ops.alloc_hw_stats || !dev->port_data)
return;
@@ -610,13 +610,12 @@ void rdma_counter_init(struct ib_device *dev)
return;
fail:
- rdma_for_each_port(dev, port) {
+ for (i = port; i >= rdma_start_port(dev); i--) {
port_counter = &dev->port_data[port].port_counter;
kfree(port_counter->hstats);
port_counter->hstats = NULL;
+ mutex_destroy(&port_counter->lock);
}
-
- return;
}
void rdma_counter_release(struct ib_device *dev)
@@ -630,5 +629,6 @@ void rdma_counter_release(struct ib_device *dev)
rdma_for_each_port(dev, port) {
port_counter = &dev->port_data[port].port_counter;
kfree(port_counter->hstats);
+ mutex_destroy(&port_counter->lock);
}
}