RDMA: Add error handling to ib_core_init()
authorNir Muchtar <nirm@voltaire.com>
Fri, 20 May 2011 18:46:10 +0000 (11:46 -0700)
committerRoland Dreier <roland@purestorage.com>
Fri, 20 May 2011 18:46:10 +0000 (11:46 -0700)
Fail RDMA midlayer initialization if sysfs setup fails.

Signed-off-by: Nir Muchtar <nirm@voltaire.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/core/device.c

index f793bf2f5da7cf035d6f05da681aea7473cfd4ea..46a7a3febc12ee178d83d795c6b91faac5ef16c2 100644 (file)
@@ -725,16 +725,24 @@ static int __init ib_core_init(void)
                return -ENOMEM;
 
        ret = ib_sysfs_setup();
-       if (ret)
+       if (ret) {
                printk(KERN_WARNING "Couldn't create InfiniBand device class\n");
+               goto err;
+       }
 
        ret = ib_cache_setup();
        if (ret) {
                printk(KERN_WARNING "Couldn't set up InfiniBand P_Key/GID cache\n");
-               ib_sysfs_cleanup();
-               destroy_workqueue(ib_wq);
+               goto err_sysfs;
        }
 
+       return 0;
+
+err_sysfs:
+       ib_sysfs_cleanup();
+
+err:
+       destroy_workqueue(ib_wq);
        return ret;
 }