Skip to contentSkip to conversation

PCI: qcom: Fix probe error paths

PATCH Applied Johan Hovold 5 participants 8 messages Apr 1, 2022 – Apr 27, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover PCI: qcom: Fix probe error paths

This series fixes a few problems in the probe error handling which could cause trouble, for example, on probe deferral.

Johan

Changes in v2
- Capitalise subject lines according to PCI subsystem conventions

Johan Hovold (2):
PCI: qcom: Fix runtime PM imbalance on probe errors
PCI: qcom: Fix unbalanced PHY init on probe errors

 drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/2 PCI: qcom: Fix runtime PM imbalance on probe errors

Drop the leftover pm_runtime_disable() calls from the late probe error paths that would, for example, prevent runtime PM from being reenabled after a probe deferral.

Fixes 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support")
Cc Bjorn Andersson <[email protected]>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +1 -4
index 20a0e6533a1c..0b0bd71f1bd2 100644
@@ -1616,17 +1616,14 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	pp->ops = &qcom_pcie_dw_ops;
 
 	ret = phy_init(pcie->phy);
-	if (ret) {
-		pm_runtime_disable(&pdev->dev);
+	if (ret)
 		goto err_pm_runtime_put;
-	}
 
 	platform_set_drvdata(pdev, pcie);
 
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "cannot initialize host\n");
-		pm_runtime_disable(&pdev->dev);
 		goto err_pm_runtime_put;
 	}
 
Signature · 1 line
2.35.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors

Quoted 8 lines · Johan Hovold

Drop the leftover pm_runtime_disable() calls from the late probe error paths that would, for example, prevent runtime PM from being reenabled after a probe deferral.

Fixes 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support")
Cc Bjorn Andersson <[email protected]>

Thanks,
Mani

Quoted 30 lines
---
 drivers/pci/controller/dwc/pcie-qcom.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +1 -4
index 20a0e6533a1c..0b0bd71f1bd2 100644
@@ -1616,17 +1616,14 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	pp->ops = &qcom_pcie_dw_ops;
 
 	ret = phy_init(pcie->phy);
-	if (ret) {
-		pm_runtime_disable(&pdev->dev);
+	if (ret)
 		goto err_pm_runtime_put;
-	}
 
 	platform_set_drvdata(pdev, pcie);
 
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "cannot initialize host\n");
-		pm_runtime_disable(&pdev->dev);
 		goto err_pm_runtime_put;
 	}
 
Signature · 1 line
2.35.1
#3 lore raw

PATCH v2 2/2 PCI: qcom: Fix unbalanced PHY init on probe errors

In reply to Johan Hovold

Make sure to undo the PHY initialisation (e.g. balance runtime PM) in case host initialisation fails during probe.

Fixes 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc Stanimir Varbanov <[email protected]>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-qcom.c +3 -1
index 0b0bd71f1bd2..df47986bda29 100644
@@ -1624,11 +1624,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);
Signature · 1 line
2.35.1
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] PCI: qcom: Fix unbalanced PHY init on probe errors

Quoted 7 lines · Johan Hovold

Make sure to undo the PHY initialisation (e.g. balance runtime PM) in case host initialisation fails during probe.

Fixes 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver")
Cc Stanimir Varbanov <[email protected]>

Thanks,
Mani

Quoted 26 lines
---
 drivers/pci/controller/dwc/pcie-qcom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-qcom.c +3 -1
index 0b0bd71f1bd2..df47986bda29 100644
@@ -1624,11 +1624,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);
Signature · 1 line
2.35.1
#5 lore raw
In reply to Johan Hovold
Quoted 9 lines · Johan Hovold

This series fixes a few problems in the probe error handling which could cause trouble, for example, on probe deferral.

Johan Hovold (2):
PCI: qcom: Fix runtime PM imbalance on probe errors
PCI: qcom: Fix unbalanced PHY init on probe errors

 drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Any comments to this series? Does it need a Qualcomm maintainer ack to be merged? Bjorn?

Johan

Acked-by on the v2 series
#6 lore raw
In reply to Johan Hovold

Hi Johan,

Quoted 10 lines · Johan Hovold

This series fixes a few problems in the probe error handling which could cause trouble, for example, on probe deferral.

Johan

Changes in v2
- Capitalise subject lines according to PCI subsystem conventions

Quoted 7 lines

Johan Hovold (2):
PCI: qcom: Fix runtime PM imbalance on probe errors
PCI: qcom: Fix unbalanced PHY init on probe errors

 drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
Signature · 2 lines
regards,
Stan
#7 lore raw
In reply to Johan Hovold
Quoted 10 lines · Johan Hovold

This series fixes a few problems in the probe error handling which could cause trouble, for example, on probe deferral.

Johan

Changes in v2
- Capitalise subject lines according to PCI subsystem conventions

[...]

Applied to pci/qcom, thanks!

[1/2] PCI: qcom: Fix runtime PM imbalance on probe errors

      https://git.kernel.org/lpieralisi/pci/c/b986db29ed
[2/2] PCI: qcom: Fix unbalanced PHY init on probe errors
      https://git.kernel.org/lpieralisi/pci/c/3ae93c5a97

Thanks,
Lorenzo