@@ -484,10 +484,8 @@ int core_tpg_register(
ret = core_tpg_add_lun(se_tpg, se_tpg->tpg_virt_lun0,
true, g_lun0_dev);
- if (ret < 0) {
- kfree(se_tpg->tpg_virt_lun0);
- return ret;
- }
+ if (ret < 0)
+ goto out_free_lun0;
}
pr_debug("TARGET_CORE[%s]: Allocated portal_group for endpoint: %s, "
@@ -497,6 +495,10 @@ int core_tpg_register(
se_tpg->proto_id, se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
return 0;
+
+out_free_lun0:
+ kfree(se_tpg->tpg_virt_lun0);
+ return ret;
}
EXPORT_SYMBOL(core_tpg_register);