net: phy: intel-xway: fix OF node refcount leakage

Automated review spotted am OF node reference count leakage when
checking if the 'leds' child node exists.

Call of_put_node() to correctly maintain the refcount.

Link: https://netdev-ai.bots.linux.dev/ai-review.html?id=20f173ba-0c64-422b-a663-fea4b4ad01d0
Fixes: 1758af47b9 ("net: phy: intel-xway: add support for PHY LEDs")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/e3275e1c1cdca7e6426bb9c11f33bd84b8d900c8.1768783208.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Daniel Golle 2026-01-19 00:41:54 +00:00 committed by Jakub Kicinski
parent b97d5eedf4
commit 79912b256e

View File

@ -277,7 +277,7 @@ static int xway_gphy_init_leds(struct phy_device *phydev)
static int xway_gphy_config_init(struct phy_device *phydev)
{
struct device_node *np = phydev->mdio.dev.of_node;
struct device_node *np;
int err;
/* Mask all interrupts */
@ -286,7 +286,10 @@ static int xway_gphy_config_init(struct phy_device *phydev)
return err;
/* Use default LED configuration if 'leds' node isn't defined */
if (!of_get_child_by_name(np, "leds"))
np = of_get_child_by_name(phydev->mdio.dev.of_node, "leds");
if (np)
of_node_put(np);
else
xway_gphy_init_leds(phydev);
/* Clear all pending interrupts */