diff options
author | Aman Sharma <amanharitsh123@gmail.com> | 2020-03-11 20:19:02 +0100 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-05-12 15:14:43 +0200 |
commit | 0584bff09629666eea97c7ac428e55b00df211f5 (patch) | |
tree | 0f1ffb119ca31d5fbb5b996a976eafaa120b98c7 /drivers/pci/controller/pcie-mediatek.c | |
parent | driver core: platform: Clarify that IRQ 0 is invalid (diff) | |
download | linux-0584bff09629666eea97c7ac428e55b00df211f5.tar.xz linux-0584bff09629666eea97c7ac428e55b00df211f5.zip |
PCI: Check for platform_get_irq() failure consistently
The platform_get_irq*() interfaces return either a negative error number or
a valid IRQ. 0 is not a valid return value, so check for "< 0" to detect
failure as recommended by the function documentation.
On failure, return the error number from platform_get_irq*() instead of
making up a new one.
Link: https://lore.kernel.org/r/cover.1583952275.git.amanharitsh123@gmail.com
[bhelgaas: commit log, squash into one patch]
Signed-off-by: Aman Sharma <amanharitsh123@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>
Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Marc Gonzalez <marc.w.gonzalez@free.fr>
Diffstat (limited to 'drivers/pci/controller/pcie-mediatek.c')
-rw-r--r-- | drivers/pci/controller/pcie-mediatek.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index cb982891b22b..ebfa7d5a4e2d 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -651,6 +651,9 @@ static int mtk_pcie_setup_irq(struct mtk_pcie_port *port, } port->irq = platform_get_irq(pdev, port->slot); + if (port->irq < 0) + return port->irq; + irq_set_chained_handler_and_data(port->irq, mtk_pcie_intr_handler, port); |