Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87d4abda authored by Dotan Barak's avatar Dotan Barak Committed by Roland Dreier
Browse files

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: default avatarDotan Barak <dotanb@dev.mellanox.co.il>
Reviewed-by: default avatarSean Hefty <sean.hefty@intel.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent f457ce47
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -3848,24 +3848,28 @@ static int __init ib_cm_init(void)
	INIT_LIST_HEAD(&cm.timewait_list);
	INIT_LIST_HEAD(&cm.timewait_list);


	ret = class_register(&cm_class);
	ret = class_register(&cm_class);
	if (ret)
	if (ret) {
		return -ENOMEM;
		ret = -ENOMEM;
		goto error1;
	}


	cm.wq = create_workqueue("ib_cm");
	cm.wq = create_workqueue("ib_cm");
	if (!cm.wq) {
	if (!cm.wq) {
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto error1;
		goto error2;
	}
	}


	ret = ib_register_client(&cm_client);
	ret = ib_register_client(&cm_client);
	if (ret)
	if (ret)
		goto error2;
		goto error3;


	return 0;
	return 0;
error2:
error3:
	destroy_workqueue(cm.wq);
	destroy_workqueue(cm.wq);
error1:
error2:
	class_unregister(&cm_class);
	class_unregister(&cm_class);
error1:
	idr_destroy(&cm.local_id_table);
	return ret;
	return ret;
}
}