[PATCH] PCI: eswin: Fix resource leak on dw_pcie_host_init() failure

From: Felix Gu

Date: Thu Apr 16 2026 - 08:37:00 EST


When dw_pcie_host_init() fails, the code jumps to err_init which
only calls pm_runtime_put() but skips the clean up of port resources.

Fixes: b593c26d081a ("PCI: eswin: Add ESWIN PCIe Root Complex driver")
Signed-off-by: Felix Gu <ustc.gu@xxxxxxxxx>
---
drivers/pci/controller/dwc/pcie-eswin.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-eswin.c b/drivers/pci/controller/dwc/pcie-eswin.c
index 2845832b3824..0185b55e09e3 100644
--- a/drivers/pci/controller/dwc/pcie-eswin.c
+++ b/drivers/pci/controller/dwc/pcie-eswin.c
@@ -348,7 +348,7 @@ static int eswin_pcie_probe(struct platform_device *pdev)
ret = dw_pcie_host_init(&pci->pp);
if (ret) {
dev_err(dev, "Failed to init host\n");
- goto err_init;
+ goto err_pm_runtime_put;
}

return 0;
@@ -358,7 +358,6 @@ static int eswin_pcie_probe(struct platform_device *pdev)
reset_control_put(port->perst);
list_del(&port->list);
}
-err_init:
pm_runtime_put(dev);

return ret;

---
base-commit: 936c21068d7ade00325e40d82bfd2f3f29d9f659
change-id: 20260416-eswin-4d09df4e8f48

Best regards,
--
Felix Gu <ustc.gu@xxxxxxxxx>