summaryrefslogtreecommitdiff
path: root/drivers/target
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2016-08-22 11:54:09 +0300
committerNicholas Bellinger <nab@linux-iscsi.org>2016-10-21 11:19:42 +0300
commit91b385b4909e040450389b11961a8ba8f8e9a35e (patch)
treeef7c0297470b03dffb8f9490f86ea963c28c1604 /drivers/target
parentb04bf5833e8a0d6ae4e3f7b35b30c4ab6ff7ea1b (diff)
downloadlinux-91b385b4909e040450389b11961a8ba8f8e9a35e.tar.xz
target/tcm_fc: return detailed error in ft_sess_create()
Not every failure is due to out-of-memory; the ACLs might not be set, too. So return a detailed error code in ft_sess_create() instead of just a NULL pointer. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/tcm_fc/tfc_sess.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 6ffbb603d912..cc8c2614397b 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -223,7 +223,7 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
sess = kzalloc(sizeof(*sess), GFP_KERNEL);
if (!sess)
- return NULL;
+ return ERR_PTR(-ENOMEM);
kref_init(&sess->kref); /* ref for table entry */
sess->tport = tport;
@@ -234,8 +234,9 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
TARGET_PROT_NORMAL, &initiatorname[0],
sess, ft_sess_alloc_cb);
if (IS_ERR(sess->se_sess)) {
+ int rc = PTR_ERR(sess->se_sess);
kfree(sess);
- return NULL;
+ sess = ERR_PTR(rc);
}
return sess;
}