IB/cm: Destroy idr as part of the module init error flow
Clean the idr as part of the error flow since it is a resource too. Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
f457ce471c
commit
87d4abda83
|
@ -3848,24 +3848,28 @@ static int __init ib_cm_init(void)
|
|||
INIT_LIST_HEAD(&cm.timewait_list);
|
||||
|
||||
ret = class_register(&cm_class);
|
||||
if (ret)
|
||||
return -ENOMEM;
|
||||
|
||||
cm.wq = create_workqueue("ib_cm");
|
||||
if (!cm.wq) {
|
||||
if (ret) {
|
||||
ret = -ENOMEM;
|
||||
goto error1;
|
||||
}
|
||||
|
||||
cm.wq = create_workqueue("ib_cm");
|
||||
if (!cm.wq) {
|
||||
ret = -ENOMEM;
|
||||
goto error2;
|
||||
}
|
||||
|
||||
ret = ib_register_client(&cm_client);
|
||||
if (ret)
|
||||
goto error2;
|
||||
goto error3;
|
||||
|
||||
return 0;
|
||||
error2:
|
||||
error3:
|
||||
destroy_workqueue(cm.wq);
|
||||
error1:
|
||||
error2:
|
||||
class_unregister(&cm_class);
|
||||
error1:
|
||||
idr_destroy(&cm.local_id_table);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue