Lee Duncan 2a3382
From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Lee Duncan 2a3382
Date: Sat, 3 Apr 2021 23:43:55 +0300
Lee Duncan 2a3382
Subject: scsi: hisi_sas: Fix IRQ checks
Lee Duncan 2a3382
Git-commit: 6c11dc060427e07ca144eacaccd696106b361b06
Lee Duncan 2a3382
Patch-mainline: v5.13-rc1
Lee Duncan 2a3382
References: bsc#1186963
Lee Duncan 2a3382
Lee Duncan 2a3382
Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
Lee Duncan 2a3382
into account that irq_of_parse_and_map() and platform_get_irq() have a
Lee Duncan 2a3382
different way of indicating an error: the former returns 0 and the latter
Lee Duncan 2a3382
returns a negative error code. Fix up the IRQ checks!
Lee Duncan 2a3382
Lee Duncan 2a3382
Link: https://lore.kernel.org/r/810f26d3-908b-1d6b-dc5c-40019726baca@omprussia.ru
Lee Duncan 2a3382
Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
Lee Duncan 2a3382
Acked-by: John Garry <john.garry@huawei.com>
Lee Duncan 2a3382
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Lee Duncan 2a3382
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Duncan 2a3382
Acked-by: Lee Duncan <lduncan@suse.com>
Lee Duncan 2a3382
---
Lee Duncan 2a3382
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 6 +++---
Lee Duncan 2a3382
 1 file changed, 3 insertions(+), 3 deletions(-)
Lee Duncan 2a3382
Lee Duncan 2a3382
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
Lee Duncan 2a3382
index 7451377c4cb6..3e359ac752fd 100644
Lee Duncan 2a3382
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
Lee Duncan 2a3382
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
Lee Duncan 2a3382
@@ -1646,7 +1646,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
Lee Duncan 2a3382
 		idx = i * HISI_SAS_PHY_INT_NR;
Lee Duncan 2a3382
 		for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) {
Lee Duncan 2a3382
 			irq = platform_get_irq(pdev, idx);
Lee Duncan 2a3382
-			if (!irq) {
Lee Duncan 2a3382
+			if (irq < 0) {
Lee Duncan 2a3382
 				dev_err(dev, "irq init: fail map phy interrupt %d\n",
Lee Duncan 2a3382
 					idx);
Lee Duncan 2a3382
 				return -ENOENT;
Lee Duncan 2a3382
@@ -1665,7 +1665,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
Lee Duncan 2a3382
 	idx = hisi_hba->n_phy * HISI_SAS_PHY_INT_NR;
Lee Duncan 2a3382
 	for (i = 0; i < hisi_hba->queue_count; i++, idx++) {
Lee Duncan 2a3382
 		irq = platform_get_irq(pdev, idx);
Lee Duncan 2a3382
-		if (!irq) {
Lee Duncan 2a3382
+		if (irq < 0) {
Lee Duncan 2a3382
 			dev_err(dev, "irq init: could not map cq interrupt %d\n",
Lee Duncan 2a3382
 				idx);
Lee Duncan 2a3382
 			return -ENOENT;
Lee Duncan 2a3382
@@ -1683,7 +1683,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)
Lee Duncan 2a3382
 	idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + hisi_hba->queue_count;
Lee Duncan 2a3382
 	for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++, idx++) {
Lee Duncan 2a3382
 		irq = platform_get_irq(pdev, idx);
Lee Duncan 2a3382
-		if (!irq) {
Lee Duncan 2a3382
+		if (irq < 0) {
Lee Duncan 2a3382
 			dev_err(dev, "irq init: could not map fatal interrupt %d\n",
Lee Duncan 2a3382
 				idx);
Lee Duncan 2a3382
 			return -ENOENT;
Lee Duncan 2a3382