Commit 1f981de5 authored by Roland Dreier's avatar Roland Dreier Committed by Nicholas Bellinger

iscsi-target: Use list_first_entry() where appropriate

Instead of using the obfuscated pattern of

	list_for_each_entry(var, list, ...)
		break;

to set var to the first entry of a list, use the straightforward

	var = list_first_entry(list, ...);
Reported-by: default avatarJoern Engel <joern@logfs.org>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 48c2567d
...@@ -66,8 +66,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) ...@@ -66,8 +66,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
return NULL; return NULL;
} }
list_for_each_entry(ts, &inactive_ts_list, ts_list) ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list);
break;
list_del(&ts->ts_list); list_del(&ts->ts_list);
iscsit_global->inactive_ts--; iscsit_global->inactive_ts--;
......
...@@ -500,8 +500,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *c ...@@ -500,8 +500,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *c
spin_unlock_bh(&conn->immed_queue_lock); spin_unlock_bh(&conn->immed_queue_lock);
return NULL; return NULL;
} }
list_for_each_entry(qr, &conn->immed_queue_list, qr_list) qr = list_first_entry(&conn->immed_queue_list,
break; struct iscsi_queue_req, qr_list);
list_del(&qr->qr_list); list_del(&qr->qr_list);
if (qr->cmd) if (qr->cmd)
...@@ -575,8 +575,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *co ...@@ -575,8 +575,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *co
return NULL; return NULL;
} }
list_for_each_entry(qr, &conn->response_queue_list, qr_list) qr = list_first_entry(&conn->response_queue_list,
break; struct iscsi_queue_req, qr_list);
list_del(&qr->qr_list); list_del(&qr->qr_list);
if (qr->cmd) if (qr->cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment