[PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers

From: Claudiu Beznea

Date: Mon Oct 19 2026 - 02:52:01 EST


From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>

rzg3s_pcie_probe() releases the sysc_np OF node through the
__free(device_node) annotation, while the rest of the function uses
goto-based unwinding. According to cleanup.h, the two styles should
not be mixed within a function, as this makes the ownership semantics
hard to follow. Drop the annotation and call of_node_put() explicitly
on the exit paths instead.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
---

Changes in v7:
- none, this patch is new

drivers/pci/controller/pcie-rzg3s-host.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index 0ef49bb5ab1a..bee3e46d025f 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1822,9 +1822,8 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
struct pci_host_bridge *bridge;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
- struct device_node *sysc_np __free(device_node) =
- of_parse_phandle(np, "renesas,sysc", 0);
struct rzg3s_pcie_host *host;
+ struct device_node *sysc_np;
struct rzg3s_sysc *sysc;
int ret;

@@ -1859,7 +1858,14 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
if (ret)
return ret;

+ sysc_np = of_parse_phandle(np, "renesas,sysc", 0);
+ if (!sysc_np) {
+ ret = -ENODEV;
+ goto port_refclk_put;
+ }
+
sysc->regmap = syscon_node_to_regmap(sysc_np);
+ of_node_put(sysc_np);
if (IS_ERR(sysc->regmap)) {
ret = PTR_ERR(sysc->regmap);
goto port_refclk_put;
--
2.43.0