Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: histb: Fix an error handling path in histb_pcie_probe()
@ 2025-03-01 18:42 Christophe JAILLET
  2025-03-09 19:58 ` Krzysztof Wilczyński
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-03-01 18:42 UTC (permalink / raw)
  To: Shawn Guo, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Jianguo Sun
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pci

If an error occurs after a successful phy_init() call, then phy_exit()
should be called.

Add the missing call, as already done in the remove function.

Fixes: bbd11bddb398 ("PCI: hisi: Add HiSilicon STB SoC PCIe controller driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
This patch is compile tested only.

It is also completly speculative. Review with care.
---
 drivers/pci/controller/dwc/pcie-histb.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c
index 615a0e3e6d7e..63b701881357 100644
--- a/drivers/pci/controller/dwc/pcie-histb.c
+++ b/drivers/pci/controller/dwc/pcie-histb.c
@@ -409,16 +409,22 @@ static int histb_pcie_probe(struct platform_device *pdev)
 	ret = histb_pcie_host_enable(pp);
 	if (ret) {
 		dev_err(dev, "failed to enable host\n");
-		return ret;
+		goto err_exit_phy;
 	}
 
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "failed to initialize host\n");
-		return ret;
+		goto err_exit_phy;
 	}
 
 	return 0;
+
+err_exit_phy:
+	if (hipcie->phy)
+		phy_exit(hipcie->phy);
+
+	return ret;
 }
 
 static void histb_pcie_remove(struct platform_device *pdev)
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: histb: Fix an error handling path in histb_pcie_probe()
  2025-03-01 18:42 [PATCH] PCI: histb: Fix an error handling path in histb_pcie_probe() Christophe JAILLET
@ 2025-03-09 19:58 ` Krzysztof Wilczyński
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Wilczyński @ 2025-03-09 19:58 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Shawn Guo, Lorenzo Pieralisi, Manivannan Sadhasivam, Rob Herring,
	Bjorn Helgaas, Jianguo Sun, linux-kernel, kernel-janitors,
	linux-pci

Hello,

> If an error occurs after a successful phy_init() call, then phy_exit()
> should be called.
> 
> Add the missing call, as already done in the remove function.

Applied to controller/histb, thank you!

	Krzysztof

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-09 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-01 18:42 [PATCH] PCI: histb: Fix an error handling path in histb_pcie_probe() Christophe JAILLET
2025-03-09 19:58 ` Krzysztof Wilczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox