Re: [PATCH] net: thunderx: fix fwnode_handle leak in bgx_init_of_phy()
From: Andrew Lunn
Date: Sun Oct 25 2026 - 22:04:12 EST
On Sun, Oct 25, 2026 at 10:31:59PM +0200, Selby Mashiki wrote:
> In bgx_init_of_phy(), device_for_each_child_node(&bgx->pdev->dev, fwn)
> breaks out of the loop without calling fwnode_handle_put(fwn) if
> to_of_node(fwn) returns NULL.
>
> Switch the loop to device_for_each_child_node_scoped() and remove the
> manual of_node_put(node) calls so the child fwnode_handle reference is
> automatically released on all loop exit paths.
>
> Fixes: 9d28f9491258 ("net: thunder_bgx: add a missing of_node_put")
> Signed-off-by: Selby Mashiki <mashikiselby@xxxxxxxxx>
Does a leaked OF node bother anybody? I would say no, so please post
this to net-next.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Andrew