Skip to content

Commit

Permalink
target/tcm_fc: return detailed error in ft_sess_create()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
  • Loading branch information
hreinecke authored and nablio3000 committed Oct 21, 2016
1 parent b04bf58 commit 91b385b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/target/tcm_fc/tfc_sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 91b385b

Please sign in to comment.