PCI: altera: Fix platform_get_irq() error handling
authorFabio Estevam <fabio.estevam@nxp.com>
Thu, 31 Aug 2017 17:52:07 +0000 (14:52 -0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 5 Sep 2017 18:36:28 +0000 (13:36 -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: Ley Foon Tan <lftan@altera.com>
drivers/pci/host/pcie-altera-msi.c
drivers/pci/host/pcie-altera.c

index 2864030789f07ac147a41b0188095afa4451a92e..d8141f4865deeba555597723bf88caa066eab9d3 100644 (file)
@@ -265,9 +265,9 @@ static int altera_msi_probe(struct platform_device *pdev)
                return ret;
 
        msi->irq = platform_get_irq(pdev, 0);
-       if (msi->irq <= 0) {
+       if (msi->irq < 0) {
                dev_err(&pdev->dev, "failed to map IRQ: %d\n", msi->irq);
-               ret = -ENODEV;
+               ret = msi->irq;
                goto err;
        }
 
index 6fced590eb87935136045bdd8631821775a3ba49..b468b8cccf8d120e6d84350510da22553627f88a 100644 (file)
@@ -558,9 +558,9 @@ static int altera_pcie_parse_dt(struct altera_pcie *pcie)
 
        /* setup IRQ */
        pcie->irq = platform_get_irq(pdev, 0);
-       if (pcie->irq <= 0) {
+       if (pcie->irq < 0) {
                dev_err(dev, "failed to get IRQ: %d\n", pcie->irq);
-               return -EINVAL;
+               return pcie->irq;
        }
 
        irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie);