Re: [PATCH] PCI: rcar-gen4: Fix device_node leak in rcar_gen4_pcie_host_msi_addr()

From: Marek Vasut

Date: Tue Sep 22 2026 - 14:08:53 EST


On 9/22/26 8:38 AM, Fuad Tabba wrote:

Hello Fuad,

On Mon, 21 Sep 2026 22:47:30 +0200, Marek Vasut <marek.vasut@xxxxxxxxxxx> wrote:

[...]

I think you have to call of_node_put() on msi_node(), so what about this
instead ?

The __free(device_node) is that call: it puts msi_node on every return from the function, the success path included, so no goto is needed. It's the same scoped cleanup pci-imx6.c and pcie-rzg3s-host.c use for their device_node lookups.

Oh, this is very nice, TIL, thank you.

Reviewed-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxxxx>
Tested-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxxxx> # Retronix R-Car V4H Sparrow Hawk

diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c

[...]

"

Also, I think drivers/pci/controller/pcie-iproc.c
iproc_pcie_msi_enable() needs similar fix ?

I don't think so: iproc_pcie_msi_enable() already puts the node at out_put_node, on the steer failure and the success paths alike.

Could you maybe send similar simplification patch ?

Thank you !

--
Best regards,
Marek Vasut