target/iscsi: Fix network portal creation race
[pandora-kernel.git] / drivers / target / target_core_configfs.c
index 93d4f6a..013b133 100644 (file)
@@ -3123,6 +3123,7 @@ static int __init target_core_init_configfs(void)
                                GFP_KERNEL);
        if (!target_cg->default_groups) {
                pr_err("Unable to allocate target_cg->default_groups\n");
+               ret = -ENOMEM;
                goto out_global;
        }
 
@@ -3138,6 +3139,7 @@ static int __init target_core_init_configfs(void)
                                GFP_KERNEL);
        if (!hba_cg->default_groups) {
                pr_err("Unable to allocate hba_cg->default_groups\n");
+               ret = -ENOMEM;
                goto out_global;
        }
        config_group_init_type_name(&alua_group,
@@ -3153,6 +3155,7 @@ static int __init target_core_init_configfs(void)
                        GFP_KERNEL);
        if (!alua_cg->default_groups) {
                pr_err("Unable to allocate alua_cg->default_groups\n");
+               ret = -ENOMEM;
                goto out_global;
        }
 
@@ -3164,14 +3167,17 @@ static int __init target_core_init_configfs(void)
         * Add core/alua/lu_gps/default_lu_gp
         */
        lu_gp = core_alua_allocate_lu_gp("default_lu_gp", 1);
-       if (IS_ERR(lu_gp))
+       if (IS_ERR(lu_gp)) {
+               ret = -ENOMEM;
                goto out_global;
+       }
 
        lu_gp_cg = &alua_lu_gps_group;
        lu_gp_cg->default_groups = kzalloc(sizeof(struct config_group) * 2,
                        GFP_KERNEL);
        if (!lu_gp_cg->default_groups) {
                pr_err("Unable to allocate lu_gp_cg->default_groups\n");
+               ret = -ENOMEM;
                goto out_global;
        }
 
@@ -3199,7 +3205,8 @@ static int __init target_core_init_configfs(void)
        if (ret < 0)
                goto out;
 
-       if (core_dev_setup_virtual_lun0() < 0)
+       ret = core_dev_setup_virtual_lun0();
+       if (ret < 0)
                goto out;
 
        return 0;