summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/cma_configfs.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/cma_configfs.c
parenta511f82218fb14b3d6fbbce3c35759aa4920a734 (diff)
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/cma_configfs.c')
-rw-r--r--drivers/infiniband/core/cma_configfs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cma_configfs.c b/drivers/infiniband/core/cma_configfs.c
index 3ec2c415bb70..8b0b5ae22e4c 100644
--- a/drivers/infiniband/core/cma_configfs.c
+++ b/drivers/infiniband/core/cma_configfs.c
@@ -342,12 +342,18 @@ static struct configfs_subsystem cma_subsys = {
int __init cma_configfs_init(void)
{
+ int ret;
+
config_group_init(&cma_subsys.su_group);
mutex_init(&cma_subsys.su_mutex);
- return configfs_register_subsystem(&cma_subsys);
+ ret = configfs_register_subsystem(&cma_subsys);
+ if (ret)
+ mutex_destroy(&cma_subsys.su_mutex);
+ return ret;
}
void __exit cma_configfs_exit(void)
{
configfs_unregister_subsystem(&cma_subsys);
+ mutex_destroy(&cma_subsys.su_mutex);
}