diff options
| author | Dotan Barak <dotanb@dev.mellanox.co.il> | 2012-07-11 11:39:31 -0400 |
|---|---|---|
| committer | Roland Dreier <roland@purestorage.com> | 2012-07-11 12:22:58 -0400 |
| commit | 87d4abda83a125dec65181a6ecce3035db76d46a (patch) | |
| tree | 81a69674623e3dd7ad5d7e0aeba3a27b0bad9ce0 | |
| parent | f457ce471c522cadf697b873e2cf46e458e90bef (diff) | |
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>
| -rw-r--r-- | drivers/infiniband/core/cm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index c889aaef3416..d67999f6e34a 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
| @@ -3848,24 +3848,28 @@ static int __init ib_cm_init(void) | |||
| 3848 | INIT_LIST_HEAD(&cm.timewait_list); | 3848 | INIT_LIST_HEAD(&cm.timewait_list); |
| 3849 | 3849 | ||
| 3850 | ret = class_register(&cm_class); | 3850 | ret = class_register(&cm_class); |
| 3851 | if (ret) | 3851 | if (ret) { |
| 3852 | return -ENOMEM; | 3852 | ret = -ENOMEM; |
| 3853 | goto error1; | ||
| 3854 | } | ||
| 3853 | 3855 | ||
| 3854 | cm.wq = create_workqueue("ib_cm"); | 3856 | cm.wq = create_workqueue("ib_cm"); |
| 3855 | if (!cm.wq) { | 3857 | if (!cm.wq) { |
| 3856 | ret = -ENOMEM; | 3858 | ret = -ENOMEM; |
| 3857 | goto error1; | 3859 | goto error2; |
| 3858 | } | 3860 | } |
| 3859 | 3861 | ||
| 3860 | ret = ib_register_client(&cm_client); | 3862 | ret = ib_register_client(&cm_client); |
| 3861 | if (ret) | 3863 | if (ret) |
| 3862 | goto error2; | 3864 | goto error3; |
| 3863 | 3865 | ||
| 3864 | return 0; | 3866 | return 0; |
| 3865 | error2: | 3867 | error3: |
| 3866 | destroy_workqueue(cm.wq); | 3868 | destroy_workqueue(cm.wq); |
| 3867 | error1: | 3869 | error2: |
| 3868 | class_unregister(&cm_class); | 3870 | class_unregister(&cm_class); |
| 3871 | error1: | ||
| 3872 | idr_destroy(&cm.local_id_table); | ||
| 3869 | return ret; | 3873 | return ret; |
| 3870 | } | 3874 | } |
| 3871 | 3875 | ||
