Skip to content

Commit

Permalink
scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
Browse files Browse the repository at this point in the history
Use the right helper to avoid poking around in the list's internals.

Link: https://lore.kernel.org/r/ed669555c73aab95b29444c10066f492c0c43391.1599765652.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <[email protected]>
Reviewed-by: Benjamin Block <[email protected]>
Signed-off-by: Julian Wiedmann <[email protected]>
Signed-off-by: Benjamin Block <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
julianwiedmann authored and martinkpetersen committed Sep 15, 2020
1 parent 3f4fee0 commit addf137
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/s390/scsi/zfcp_erp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ static enum zfcp_erp_act_result zfcp_erp_strategy(
static int zfcp_erp_thread(void *data)
{
struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
struct list_head *next;
struct zfcp_erp_action *act;
unsigned long flags;

Expand All @@ -1620,12 +1619,11 @@ static int zfcp_erp_thread(void *data)
break;

write_lock_irqsave(&adapter->erp_lock, flags);
next = adapter->erp_ready_head.next;
act = list_first_entry_or_null(&adapter->erp_ready_head,
struct zfcp_erp_action, list);
write_unlock_irqrestore(&adapter->erp_lock, flags);

if (next != &adapter->erp_ready_head) {
act = list_entry(next, struct zfcp_erp_action, list);

if (act) {
/* there is more to come after dismission, no notify */
if (zfcp_erp_strategy(act) != ZFCP_ERP_DISMISSED)
zfcp_erp_wakeup(adapter);
Expand Down

0 comments on commit addf137

Please sign in to comment.