[PATCH net] net: phy: intel-xway: fix OF node refcount leakage

Daniel Golle posted 1 patch 2 weeks, 6 days ago
There is a newer version of this series
drivers/net/phy/intel-xway.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[PATCH net] net: phy: intel-xway: fix OF node refcount leakage
Posted by Daniel Golle 2 weeks, 6 days ago
Automated review spotted an OF node reference count when checking if the
'leds' child node exists. Call of_put_node() to maintain the refcount.

Link: https://netdev-ai.bots.linux.dev/ai-review.html?id=20f173ba-0c64-422b-a663-fea4b4ad01d0
Fixes: ("1758af47b98c1 net: phy: intel-xway: add support for PHY LEDs")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/phy/intel-xway.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c
index 9766dd99afaa0..12ff4c1f285d2 100644
--- a/drivers/net/phy/intel-xway.c
+++ b/drivers/net/phy/intel-xway.c
@@ -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 */
-- 
2.52.0
Re: [PATCH net] net: phy: intel-xway: fix OF node refcount leakage
Posted by Andrew Lunn 2 weeks, 4 days ago
On Sun, Jan 18, 2026 at 03:57:04AM +0000, Daniel Golle wrote:
> Automated review spotted an OF node reference count when checking if the
> 'leds' child node exists. Call of_put_node() to maintain the refcount.
> 
> Link: https://netdev-ai.bots.linux.dev/ai-review.html?id=20f173ba-0c64-422b-a663-fea4b4ad01d0
> Fixes: ("1758af47b98c1 net: phy: intel-xway: add support for PHY LEDs")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Re: [PATCH net] net: phy: intel-xway: fix OF node refcount leakage
Posted by Daniel Golle 2 weeks, 4 days ago
On Mon, Jan 19, 2026 at 03:05:54PM +0100, Andrew Lunn wrote:
> On Sun, Jan 18, 2026 at 03:57:04AM +0000, Daniel Golle wrote:
> > Automated review spotted an OF node reference count when checking if the
> > 'leds' child node exists. Call of_put_node() to maintain the refcount.
> > 
> > Link: https://netdev-ai.bots.linux.dev/ai-review.html?id=20f173ba-0c64-422b-a663-fea4b4ad01d0
> > Fixes: ("1758af47b98c1 net: phy: intel-xway: add support for PHY LEDs")
> > Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

I guess you meant to put your Reviewed-by: under v2 I've sent yesterday
because this initial submission has a fat-fingered Fixes:-tag...

See
https://patchwork.kernel.org/project/netdevbpf/patch/e3275e1c1cdca7e6426bb9c11f33bd84b8d900c8.1768783208.git.daniel@makrotopia.org/