[PATCH] net: mdio: mdio-mux: fix device_node reference leak on success
From: Haotian Zhang
Date: Thu Oct 08 2026 - 14:01:16 EST
mdio_mux_init() obtains a reference to the parent bus device_node with
of_parse_phandle() when no mux_bus is passed in. All error paths release
it through err_parent_bus, but the success path at the end of the
function returns without calling of_node_put(). of_mdio_find_bus() only
takes a reference to the embedded struct device, so the device_node
reference is leaked for every multiplexer that probes successfully.
Release parent_bus_node before returning from the success path.
Fixes: 0ca2997d1452 ("netdev/of/phy: Add MDIO bus multiplexer support.")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@xxxxxxxxxxx>
---
drivers/net/mdio/mdio-mux.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c
index fe0e46bd7964..fe752120e27b 100644
--- a/drivers/net/mdio/mdio-mux.c
+++ b/drivers/net/mdio/mdio-mux.c
@@ -240,6 +240,7 @@ int mdio_mux_init(struct device *dev,
}
if (pb->children) {
*mux_handle = pb;
+ of_node_put(parent_bus_node);
return 0;
}
--
2.25.1