[PATCH 6.19 386/781] PCI: s32g: Skip Root Port removal during success

Greg Kroah-Hartman
2026-02-25T01:34:06Z

From: Vincent Guittot <vincent.guittot@linaro.org>

[ Upstream commit b79e0875fe8144fcb09e4fc1cf386cb3b2262480 ]

Currently, s32g_pcie_parse_ports() exercises the 'err_port' path even
during the success case. This results in ports getting deleted after
successful parsing of Root Ports.

Hence, skip the removal of Root Ports during success.

Fixes: 5cbc7d3e316e ("PCI: s32g: Add NXP S32G PCIe controller driver (RC)")
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
[mani: reworded subject and description]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://patch.msgid.link/20260202151050.1446165-1-vincent.guittot@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/pci/controller/dwc/pcie-nxp-s32g.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-nxp-s32g.c b/drivers/pci/controller/dwc/pcie-nxp-s32g.c
index 47745749f75c3..b3ec38099fa38 100644
--- a/drivers/pci/controller/dwc/pcie-nxp-s32g.c
+++ b/drivers/pci/controller/dwc/pcie-nxp-s32g.c
@@ -282,12 +282,12 @@ static int s32g_pcie_parse_ports(struct device *dev, struct s32g_pcie *s32g_pp)

ret = s32g_pcie_parse_port(s32g_pp, of_port);
if (ret)
- goto err_port;
+ break;
}

-err_port:
- list_for_each_entry_safe(port, tmp, &s32g_pp->ports, list)
- list_del(&port->list);
+ if (ret)
+ list_for_each_entry_safe(port, tmp, &s32g_pp->ports, list)
+ list_del(&port->list);

return ret;
}
--
2.51.0