aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-10-31 12:16:47 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-11-06 23:55:45 -0500
commit1f981de55a46777ca0da93af5faf7d3f6e7e7000 (patch)
treee2e83a261f66d4887b8684134c9cfc1ca57e2a58 /drivers/target
parent48c2567d1a10b5a2cab72b37775b886b08f88726 (diff)
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: Joern Engel <joern@logfs.org> Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_tq.c3
-rw-r--r--drivers/target/iscsi/iscsi_target_util.c8
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c
index 9d881a000e42..81289520f96b 100644
--- a/drivers/target/iscsi/iscsi_target_tq.c
+++ b/drivers/target/iscsi/iscsi_target_tq.c
@@ -66,8 +66,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
66 return NULL; 66 return NULL;
67 } 67 }
68 68
69 list_for_each_entry(ts, &inactive_ts_list, ts_list) 69 ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list);
70 break;
71 70
72 list_del(&ts->ts_list); 71 list_del(&ts->ts_list);
73 iscsit_global->inactive_ts--; 72 iscsit_global->inactive_ts--;
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index 1a91195ab619..87e153b4bd16 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -500,8 +500,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *c
500 spin_unlock_bh(&conn->immed_queue_lock); 500 spin_unlock_bh(&conn->immed_queue_lock);
501 return NULL; 501 return NULL;
502 } 502 }
503 list_for_each_entry(qr, &conn->immed_queue_list, qr_list) 503 qr = list_first_entry(&conn->immed_queue_list,
504 break; 504 struct iscsi_queue_req, qr_list);
505 505
506 list_del(&qr->qr_list); 506 list_del(&qr->qr_list);
507 if (qr->cmd) 507 if (qr->cmd)
@@ -575,8 +575,8 @@ struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *co
575 return NULL; 575 return NULL;
576 } 576 }
577 577
578 list_for_each_entry(qr, &conn->response_queue_list, qr_list) 578 qr = list_first_entry(&conn->response_queue_list,
579 break; 579 struct iscsi_queue_req, qr_list);
580 580
581 list_del(&qr->qr_list); 581 list_del(&qr->qr_list);
582 if (qr->cmd) 582 if (qr->cmd)