[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260118022907.1106701-1-kuba@kernel.org>
Date: Sat, 17 Jan 2026 18:29:07 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: daniel@...rotopia.org
Cc: Jakub Kicinski <kuba@...nel.org>,
fchan@...linear.com,
hkallweit1@...il.com,
jpovazanec@...linear.com,
yweng@...linear.com,
davem@...emloft.net,
andrew@...n.ch,
linux@...linux.org.uk,
edumazet@...gle.com,
ajayaraman@...linear.com,
john@...ozen.org,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
lrosu@...linear.com,
bxu@...linear.com,
pabeni@...hat.com
Subject: Re: [net-next] net: phy: intel-xway: workaround stale LEDs before link-up
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: phy: intel-xway: workaround stale LEDs before link-up
This patch works around a PHY firmware bug where LED manual control and
polarity configuration have no effect until a link is detected. The fix
temporarily clears BMCR_ANENABLE for 100ms to force the LED thread to start.
> diff --git a/drivers/net/phy/intel-xway.c b/drivers/net/phy/intel-xway.c
> index 9766dd99afaa..e06ed7ab0ff3 100644
> --- a/drivers/net/phy/intel-xway.c
> +++ b/drivers/net/phy/intel-xway.c
[ ... ]
> @@ -286,8 +287,33 @@ 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"))
> + if (!of_get_child_by_name(np, "leds")) {
> xway_gphy_init_leds(phydev);
> + } else {
Does this leak the device_node reference returned by of_get_child_by_name()?
The API documentation states that of_get_child_by_name() returns a node
pointer with refcount incremented, requiring of_node_put() when done.
When the "leds" node exists, the returned pointer is never captured and
of_node_put() is never called.
Other PHY drivers handle this correctly, for example vsc85xx_probe_common()
in drivers/net/phy/mscc/mscc_main.c:
np = of_get_child_by_name(phydev->mdio.dev.of_node, "leds");
if (np) {
of_node_put(np);
...
}
And of_phy_leds() in drivers/net/phy/phy_device.c also properly calls
of_node_put(leds) on all exit paths.
Note that this leak also existed in the original code before this patch,
but since this patch is touching this exact code path, it would be a good
opportunity to fix it.
--
pw-bot: cr
Powered by blists - more mailing lists