public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: daniel@makrotopia.org
Cc: Jakub Kicinski <kuba@kernel.org>,
	fchan@maxlinear.com, hkallweit1@gmail.com,
	jpovazanec@maxlinear.com, yweng@maxlinear.com,
	davem@davemloft.net, andrew@lunn.ch, linux@armlinux.org.uk,
	edumazet@google.com, ajayaraman@maxlinear.com, john@phrozen.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	lrosu@maxlinear.com, bxu@maxlinear.com, pabeni@redhat.com
Subject: Re: [net-next] net: phy: intel-xway: workaround stale LEDs before link-up
Date: Sat, 17 Jan 2026 18:29:07 -0800	[thread overview]
Message-ID: <20260118022907.1106701-1-kuba@kernel.org> (raw)
In-Reply-To: <d70a1fa9b92c7b3e7ea09b5c3216d77a8fd35265.1768432653.git.daniel@makrotopia.org>

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

  parent reply	other threads:[~2026-01-18  2:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 23:40 [PATCH net-next] net: phy: intel-xway: workaround stale LEDs before link-up Daniel Golle
2026-01-16  1:23 ` Andrew Lunn
2026-01-16  2:06   ` Daniel Golle
2026-01-18  2:29 ` Jakub Kicinski [this message]
2026-01-18  2:31   ` [net-next] " Jakub Kicinski
2026-01-18  2:33     ` Daniel Golle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260118022907.1106701-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=ajayaraman@maxlinear.com \
    --cc=andrew@lunn.ch \
    --cc=bxu@maxlinear.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fchan@maxlinear.com \
    --cc=hkallweit1@gmail.com \
    --cc=john@phrozen.org \
    --cc=jpovazanec@maxlinear.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lrosu@maxlinear.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yweng@maxlinear.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox