[PATCH] net: ethernet: sunplus: Fix ethernet-ports node leak in spl2sw_probe()
From: Wentao Liang
Date: Thu Sep 17 2026 - 07:47:00 EST
spl2sw_probe() gets a reference on the "ethernet-ports" child node but
never releases it, neither on the error paths that go to out_free_mdio
and out_unregister_dev nor on the successful return. Release the
reference automatically by declaring the node with __free(device_node).
Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 5e0e4c9ecbb0..fdc9c3196738 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -319,7 +319,7 @@ static struct device_node *spl2sw_get_eth_child_node(struct device_node *ether_n
static int spl2sw_probe(struct platform_device *pdev)
{
- struct device_node *eth_ports_np;
+ struct device_node *eth_ports_np __free(device_node) = NULL;
struct device_node *port_np;
struct spl2sw_common *comm;
struct device_node *phy_np;
--
2.34.1