PCI: qcom: Fix unbalanced PHY init on probe errors
authorJohan Hovold <johan+linaro@kernel.org>
Fri, 1 Apr 2022 13:38:54 +0000 (15:38 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 24 May 2022 21:40:45 +0000 (16:40 -0500)
Undo the PHY initialisation (e.g. balance runtime PM) if host
initialisation fails during probe.

Link: https://lore.kernel.org/r/20220401133854.10421-3-johan+linaro@kernel.org
Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Cc: stable@vger.kernel.org # 4.5
drivers/pci/controller/dwc/pcie-qcom.c

index 9191be96d6275c9bb165b835a0530da8e10a7a16..2e5464edc36e8ead402d276265d7d112070e78fe 100644 (file)
@@ -1631,11 +1631,13 @@ static int qcom_pcie_probe(struct platform_device *pdev)
        ret = dw_pcie_host_init(pp);
        if (ret) {
                dev_err(dev, "cannot initialize host\n");
-               goto err_pm_runtime_put;
+               goto err_phy_exit;
        }
 
        return 0;
 
+err_phy_exit:
+       phy_exit(pcie->phy);
 err_pm_runtime_put:
        pm_runtime_put(dev);
        pm_runtime_disable(dev);