Re: [PATCH v4 5/6] PCI: dwc: rcar-gen4: Handle PERST via reset subsystem
From: sashiko-bot@kernel.org
Date: 2026-09-05 21:38:56
Also in:
linux-pci
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: Pre-existing issues: - [High] Calling pci_epc_init_notify() and returning an error after deinitializing endpoint resources in rcar_gen4_add_dw_pcie_ep(). - [Medium] Missing of_node_put() for msi_node obtained from of_msi_xlate() in rcar_gen4_pcie_host_msi_addr(). -- commit d2f3f23cb3b48c3f0a77ad5561fa549d03ac01cf Author: Marek Vasut [off-list ref] PCI: dwc: rcar-gen4: Handle PERST via reset subsystem This patch supports handling the PERST signal via both GPIO and the reset subsystem. This change prepares the driver for R-Car Gen5 support, where PERST might only be accessible via an SCMI reset.
quoted hunk ↗ jump to hunk
diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c index c768a9c7b3b76..89472a4becc46 100644 --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -494,6 +510,22 @@ static int rcar_gen4_pcie_enable_device(struct pci_host_bridge *bridge, return 0; }
[Severity: Medium]
This is a pre-existing issue, but does rcar_gen4_pcie_host_msi_addr()
leak the msi_node obtained from of_msi_xlate() on successful return?
drivers/pci/controller/dwc/pcie-rcar-gen4.c:rcar_gen4_pcie_host_msi_addr() {
...
of_msi_xlate(dev, &msi_node, 0);
if (!msi_node)
return -ENODEV;
...
*msi_addr = addr;
return 0;
}
It appears the reference count of msi_node is never decremented on this return
path. Should we call of_node_put(msi_node) before returning?
[ ... ]
quoted hunk ↗ jump to hunk
@@ -747,6 +782,7 @@ static void rcar_gen4_pcie_remove(struct platform_device *pdev) rcar_gen4_remove_dw_pcie(rcar); rcar_gen4_pcie_unprepare(rcar); + reset_control_put(rcar->perst); }
[Severity: High]
This isn't a bug introduced by this patch, but can rcar_gen4_add_dw_pcie_ep()
trigger an initialization notification on a deinitialized endpoint if
dw_pcie_ep_init_registers() fails?
drivers/pci/controller/dwc/pcie-rcar-gen4.c:rcar_gen4_add_dw_pcie_ep() {
...
ret = dw_pcie_ep_init_registers(ep);
if (ret) {
dev_err(dev, "Failed to initialize DWC endpoint registers\n");
dw_pcie_ep_deinit(ep);
}
pci_epc_init_notify(ep->epc);
return ret;
}
Should there be a return statement inside the error handling block for
dw_pcie_ep_init_registers() to avoid calling pci_epc_init_notify()
on a deinitialized EPC?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260905212649.360498-1-marek.vasut+renesas@mailbox.org?part=5