Skip to content

Commit

Permalink
IB/cm: Destroy idr as part of the module init error flow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dotan Barak authored and Roland Dreier committed Jul 11, 2012
1 parent f457ce4 commit 87d4abd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
if (ret) {
ret = -ENOMEM;
goto error1;
}

cm.wq = create_workqueue("ib_cm");
if (!cm.wq) {
ret = -ENOMEM;
goto error1;
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;
}

Expand Down

0 comments on commit 87d4abd

Please sign in to comment.