PCI: spear13xx: Fix platform_get_irq() error handling
authorFabio Estevam <fabio.estevam@nxp.com>
Thu, 31 Aug 2017 17:52:05 +0000 (14:52 -0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 5 Sep 2017 18:33:17 +0000 (13:33 -0500)
platform_get_irq() returns a negative number on failure, so adjust the
logic to detect such condition and propagate the real error value on
failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Pratyush Anand <pratyush.anand@gmail.com>
drivers/pci/dwc/pcie-spear13xx.c

index 80897291e0fbf976f4d6ad1760f06c08152a9f6c..a1882ace3fe4e9c39019904cdda963a9b8550bba 100644 (file)
@@ -199,9 +199,9 @@ static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie,
        int ret;
 
        pp->irq = platform_get_irq(pdev, 0);
-       if (!pp->irq) {
+       if (pp->irq < 0) {
                dev_err(dev, "failed to get irq\n");
-               return -ENODEV;
+               return pp->irq;
        }
        ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler,
                               IRQF_SHARED | IRQF_NO_THREAD,