[PATCH] PCI: stm32: Re-use existing error handling path in stm32_pcie_probe()

From: Christophe JAILLET

Date: Mon Sep 29 2025 - 14:28:50 EST


An error handling path is already available, so use it instead of hand
writing the same code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-stm32.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-stm32.c b/drivers/pci/controller/dwc/pcie-stm32.c
index 964fa6f674c8..96a5fb893af4 100644
--- a/drivers/pci/controller/dwc/pcie-stm32.c
+++ b/drivers/pci/controller/dwc/pcie-stm32.c
@@ -287,18 +287,16 @@ static int stm32_pcie_probe(struct platform_device *pdev)

ret = pm_runtime_set_active(dev);
if (ret < 0) {
- clk_disable_unprepare(stm32_pcie->clk);
- stm32_remove_pcie_port(stm32_pcie);
- return dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
+ dev_err_probe(dev, ret, "Failed to activate runtime PM\n");
+ goto err_disable_clk;
}

pm_runtime_no_callbacks(dev);

ret = devm_pm_runtime_enable(dev);
if (ret < 0) {
- clk_disable_unprepare(stm32_pcie->clk);
- stm32_remove_pcie_port(stm32_pcie);
- return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+ dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
+ goto err_disable_clk;
}

ret = dw_pcie_host_init(&stm32_pcie->pci.pp);
--
2.51.0