[PATCH] net: ethernet: sunplus: spl2sw: fix OF node leak in spl2sw_probe()

From: zhaofeng2

Date: Fri Nov 27 2026 - 02:42:36 EST


From: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>

spl2sw_probe() calls of_get_child_by_name() to obtain the
"ethernet-ports" child node and uses it as the parent for
spl2sw_get_eth_child_node() in a loop, but never releases
the reference, leaking it on every probe (and on every
goto error path).

Drop the reference with of_node_put() once the node is no
longer needed.

Signed-off-by: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
---
Verified against current tree. Leak found by code inspection
(OF reference-counting audit of spl2sw_probe()).

net/ethernet/sunplus/spl2sw.c | 2 +--++
1 file changed, 2 insertions(+), 0 deletion(-)

--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -471,6 +471,8 @@
spl2sw_mac_rx_mode_set(mac);
}

+ of_node_put(eth_ports_np);
+
/* Find first valid net device. */
for (i = 0; i < MAX_NETDEV_NUM; i++) {
if (comm->ndev[i])