aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2014-09-17 18:11:28 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2014-09-17 18:11:28 -0400
commit1481473b5656d8841f63c455594f340306c22cb0 (patch)
treeb721b2ad6def22494160da9ae3d68bf883d217f1
parentda0abaee4793bac4047b3bdfd221fc54850bbf5f (diff)
target: simplify target_fabric_make_lun error path
Coverity complained that lun_cg has been dereferenced in all paths leading to NULL check. It didn't mention that only a single path could lead there and the code can be simplified even further. Signed-off-by: Joern Engel <joern@logfs.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_fabric_configfs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index 0638a672d911..dc6c781732ee 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -911,15 +911,12 @@ static struct config_group *target_fabric_make_lun(
911 GFP_KERNEL); 911 GFP_KERNEL);
912 if (!port_stat_grp->default_groups) { 912 if (!port_stat_grp->default_groups) {
913 pr_err("Unable to allocate port_stat_grp->default_groups\n"); 913 pr_err("Unable to allocate port_stat_grp->default_groups\n");
914 errno = -ENOMEM; 914 kfree(lun_cg->default_groups);
915 goto out; 915 return ERR_PTR(-ENOMEM);
916 } 916 }
917 target_stat_setup_port_default_groups(lun); 917 target_stat_setup_port_default_groups(lun);
918 918
919 return &lun->lun_group; 919 return &lun->lun_group;
920out:
921 kfree(lun_cg->default_groups);
922 return ERR_PTR(errno);
923} 920}
924 921
925static void target_fabric_drop_lun( 922static void target_fabric_drop_lun(