Skip to content

Commit 79912b2

Browse files
dangowrtkuba-moo
authored andcommitted
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: 1758af4 ("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>
1 parent b97d5ee commit 79912b2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/net/phy/intel-xway.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ static int xway_gphy_init_leds(struct phy_device *phydev)
277277

278278
static int xway_gphy_config_init(struct phy_device *phydev)
279279
{
280-
struct device_node *np = phydev->mdio.dev.of_node;
280+
struct device_node *np;
281281
int err;
282282

283283
/* Mask all interrupts */
@@ -286,7 +286,10 @@ static int xway_gphy_config_init(struct phy_device *phydev)
286286
return err;
287287

288288
/* Use default LED configuration if 'leds' node isn't defined */
289-
if (!of_get_child_by_name(np, "leds"))
289+
np = of_get_child_by_name(phydev->mdio.dev.of_node, "leds");
290+
if (np)
291+
of_node_put(np);
292+
else
290293
xway_gphy_init_leds(phydev);
291294

292295
/* Clear all pending interrupts */

0 commit comments

Comments
 (0)