]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PCI: dra7xx: Fix error handling when IRQ request fails in probe
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Tue, 27 Aug 2024 12:24:22 +0000 (17:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:25 +0000 (16:33 +0200)
commit 4d60f6d4b8fa4d7bad4aeb2b3ee5c10425bc60a4 upstream.

Commit d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq()
call to the bottom of probe") moved the IRQ request for
"dra7xx-pcie-main" towards the end of dra7xx_pcie_probe().

However, the error handling does not take into account the
initialization performed by either dra7xx_add_pcie_port() or
dra7xx_add_pcie_ep(), depending on the mode of operation.

Fix the error handling to address this.

Fixes: d4c7d1a089d6 ("PCI: dwc: dra7xx: Push request_irq() call to the bottom of probe")
Link: https://lore.kernel.org/linux-pci/20240827122422.985547-3-s-vadapalli@ti.com
Tested-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
[kwilczynski: commit log]
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/controller/dwc/pci-dra7xx.c

index 6b28453dfdcf24af58b02fe0f70430e1d746cd36..4c67fa78db2677f0a79cb045394a85cfe76c279a 100644 (file)
@@ -854,11 +854,17 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
                                        "dra7xx-pcie-main", dra7xx);
        if (ret) {
                dev_err(dev, "failed to request irq\n");
-               goto err_gpio;
+               goto err_deinit;
        }
 
        return 0;
 
+err_deinit:
+       if (dra7xx->mode == DW_PCIE_RC_TYPE)
+               dw_pcie_host_deinit(&dra7xx->pci->pp);
+       else
+               dw_pcie_ep_deinit(&dra7xx->pci->ep);
+
 err_gpio:
 err_get_sync:
        pm_runtime_put(dev);