Skip to content

Commit 91b385b

Browse files
hreineckeNicholas Bellinger
authored andcommitted
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>
1 parent b04bf58 commit 91b385b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/target/tcm_fc/tfc_sess.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
223223

224224
sess = kzalloc(sizeof(*sess), GFP_KERNEL);
225225
if (!sess)
226-
return NULL;
226+
return ERR_PTR(-ENOMEM);
227227

228228
kref_init(&sess->kref); /* ref for table entry */
229229
sess->tport = tport;
@@ -234,8 +234,9 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id,
234234
TARGET_PROT_NORMAL, &initiatorname[0],
235235
sess, ft_sess_alloc_cb);
236236
if (IS_ERR(sess->se_sess)) {
237+
int rc = PTR_ERR(sess->se_sess);
237238
kfree(sess);
238-
return NULL;
239+
sess = ERR_PTR(rc);
239240
}
240241
return sess;
241242
}

0 commit comments

Comments
 (0)