[openib-general] [PATCH] single exit in ib_mad_init_module
Sean Hefty
mshefty at ichips.intel.com
Wed Oct 13 16:02:52 PDT 2004
Patch to fix cleanup issue in ib_mad_init_module.
- Sean
--
Index: access/ib_mad.c
===================================================================
--- access/ib_mad.c (revision 987)
+++ access/ib_mad.c (working copy)
@@ -1886,6 +1886,8 @@
static int __init ib_mad_init_module(void)
{
+ int ret;
+
ib_mad_cache = kmem_cache_create("ib_mad",
sizeof(struct ib_mad_private),
0,
@@ -1894,17 +1896,23 @@
NULL);
if (!ib_mad_cache) {
printk(KERN_ERR PFX "Couldn't create ib_mad cache\n");
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto error1;
}
INIT_LIST_HEAD(&ib_mad_port_list);
if (ib_register_client(&mad_client)) {
printk(KERN_ERR PFX "Couldn't register ib_mad client\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto error2;
}
-
return 0;
+
+error2:
+ kmem_cache_destroy(ib_mad_cache);
+error1:
+ return ret;
}
static void __exit ib_mad_cleanup_module(void)
More information about the general
mailing list