PCI: dwc: dra7xx: Push request_irq() call to the bottom of probe
authorKeerthy <j-keerthy@ti.com>
Mon, 13 Mar 2017 13:43:28 +0000 (19:13 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 4 Apr 2017 13:41:30 +0000 (08:41 -0500)
Currently devm_request_irq() is being called before base, PCI fields of
dra7xx_pcie structure are populated. It is called even before
pm_runtime_enable() and pm_runtime_get_sync() are called. This will lead
to exceptions if in case an interrupt is triggered before the all of the
above are done. Hence push the devm_request_irq() call to the end of the
probe.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/dwc/pci-dra7xx.c

index 07c45ec0766270818cf7c259bf67dd57b2106a4e..7c9ed6a6675c7433f0f246ebe4b28bb0c66872a5 100644 (file)
@@ -410,13 +410,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       ret = devm_request_irq(dev, irq, dra7xx_pcie_irq_handler,
-                              IRQF_SHARED, "dra7xx-pcie-main", dra7xx);
-       if (ret) {
-               dev_err(dev, "failed to request irq\n");
-               return ret;
-       }
-
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ti_conf");
        base = devm_ioremap_nocache(dev, res->start, resource_size(res));
        if (!base)
@@ -478,6 +471,13 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_gpio;
 
+       ret = devm_request_irq(dev, irq, dra7xx_pcie_irq_handler,
+                              IRQF_SHARED, "dra7xx-pcie-main", dra7xx);
+       if (ret) {
+               dev_err(dev, "failed to request irq\n");
+               goto err_gpio;
+       }
+
        return 0;
 
 err_gpio: