Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: hisi_sas: Fix IRQ checks

Commit df2d8213d9e3 ("hisi_sas: use platform_get_irq()") failed to take
into account that irq_of_parse_and_map() and platform_get_irq() have a
different way of indicating an error: the former returns 0 and the latter
returns a negative error code. Fix up the IRQ checks!

Link: https://lore.kernel.org/r/810f26d3-908b-1d6b-dc5c-40019726baca@omprussia.ru
Fixes: df2d8213d9e3 ("hisi_sas: use platform_get_irq()")
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Sergey Shtylyov and committed by
Martin K. Petersen
6c11dc06 339c9b63

+3 -3
+3 -3
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
··· 1646 1646 idx = i * HISI_SAS_PHY_INT_NR; 1647 1647 for (j = 0; j < HISI_SAS_PHY_INT_NR; j++, idx++) { 1648 1648 irq = platform_get_irq(pdev, idx); 1649 - if (!irq) { 1649 + if (irq < 0) { 1650 1650 dev_err(dev, "irq init: fail map phy interrupt %d\n", 1651 1651 idx); 1652 1652 return -ENOENT; ··· 1665 1665 idx = hisi_hba->n_phy * HISI_SAS_PHY_INT_NR; 1666 1666 for (i = 0; i < hisi_hba->queue_count; i++, idx++) { 1667 1667 irq = platform_get_irq(pdev, idx); 1668 - if (!irq) { 1668 + if (irq < 0) { 1669 1669 dev_err(dev, "irq init: could not map cq interrupt %d\n", 1670 1670 idx); 1671 1671 return -ENOENT; ··· 1683 1683 idx = (hisi_hba->n_phy * HISI_SAS_PHY_INT_NR) + hisi_hba->queue_count; 1684 1684 for (i = 0; i < HISI_SAS_FATAL_INT_NR; i++, idx++) { 1685 1685 irq = platform_get_irq(pdev, idx); 1686 - if (!irq) { 1686 + if (irq < 0) { 1687 1687 dev_err(dev, "irq init: could not map fatal interrupt %d\n", 1688 1688 idx); 1689 1689 return -ENOENT;