net: xgene: fix mdio_np leak in xgene_mdiobus_register()

The for_each_child_of_node() loop captures mdio_np via break,
holding the refcount. of_mdiobus_register() does not consume the
reference, so it leaks on success.

Put it after registration.

Fixes: e6ad767305 ("drivers: net: Add APM X-Gene SoC ethernet driver support.")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Link: https://patch.msgid.link/20260507142024.811543-1-shitalkumar.gandhi@cambiumnetworks.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
master
Shitalkumar Gandhi 2026-05-07 19:50:24 +05:30 committed by Jakub Kicinski
parent 69754da484
commit a450063ef8
1 changed files with 3 additions and 1 deletions

View File

@ -910,7 +910,9 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata *pdata,
return -ENXIO;
}
return of_mdiobus_register(mdio, mdio_np);
ret = of_mdiobus_register(mdio, mdio_np);
of_node_put(mdio_np);
return ret;
}
/* Mask out all PHYs from auto probing. */