Skip to contentSkip to conversation

RDMA/cm: destroy idr as part of the cleanup in the error flow

PATCH New Dotan Barak 1 participant 1 message Nov 7, 2011 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 RDMA/cm: destroy idr as part of the cleanup in the error flow

Clean the idr as part of the cleanup flow since it is a resource too.

---
V2 - don't check if idr_pre_get() failed, , we'll just try again later.

 drivers/infiniband/core/cm.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
drivers/infiniband/core/cm.c +10 -6
index 4104ea2..1f04e82 100644
@@ -3847,24 +3847,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;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html