scsi: hisi_sas: Fix spin lock management in slot_index_alloc_quirk_v2_hw()

Message ID 1539702036-191138-1-git-send-email-john.garry@huawei.com
State New
Headers show
Series
  • scsi: hisi_sas: Fix spin lock management in slot_index_alloc_quirk_v2_hw()
Related show

Commit Message

John Garry Oct. 16, 2018, 3 p.m.
Currently a spin_unlock_irqrestore() call is missing on the error path, so
add it.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: John Garry <john.garry@huawei.com>


-- 
1.9.1

Comments

Martin K. Petersen Oct. 16, 2018, 9:51 p.m. | #1
John,

> Currently a spin_unlock_irqrestore() call is missing on the error path, so

> add it.


Applied to 4.20/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

Patch

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 70d6b28..cc36b64 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -806,8 +806,10 @@  static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,
 	while (1) {
 		start = find_next_zero_bit(bitmap,
 					hisi_hba->slot_index_count, start);
-		if (start >= end)
+		if (start >= end) {
+			spin_unlock_irqrestore(&hisi_hba->lock, flags);
 			return -SAS_QUEUE_FULL;
+		}
 		/*
 		  * SAS IPTT bit0 should be 1, and SATA IPTT bit0 should be 0.
 		  */