[PATCH] net: thunderx: fix fwnode_handle leak in bgx_init_of_phy()

Andrew Lunn andrew at lunn.ch
Sun Oct 25 19:02:42 PDT 2026


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 at gmail.com>

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



More information about the linux-arm-kernel mailing list