History

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.

Hannes Reinecke committed 10 years ago

Commit 91b385b1 parent b04bf581 file · +3 −2Browse files

Unified · Split

drivers/target/tcm_fc/tfc_sess.c+3−2
@@ -223,7 +223,7 @@ static struct ft_sess *ft_sess_create(struct ft_tport *tport, u32 port_id, · 222 unmodified lines
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, · 4 unmodified lines
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 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t