Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: elias.pukari@gmail.com
Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
	linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: phy: et1011c: don't write an error code to the config register
Date: Mon, 16 Nov 2026 18:59:08 +0000	[thread overview]
Message-ID: <179485554872.3136.2853572906945647083@kernel.org> (raw)
In-Reply-To: <20261115180735.649299-1-elias.pukari@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] net: phy: et1011c: premature speed update in
  et1011c_read_status()

--

> diff --git a/drivers/net/phy/et1011c.c b/drivers/net/phy/et1011c.c
> --- a/drivers/net/phy/et1011c.c
> +++ b/drivers/net/phy/et1011c.c
> @@ -62,16 +62,22 @@ static int et1011c_read_status(struct phy_device *phydev)
>  {
>  	static int speed;
>  	int ret;
> -	u32 val;
> +	int val;
>  
>  	ret = genphy_read_status(phydev);
>  
>  	if (speed != phydev->speed) {
>  		speed = phydev->speed;
>  		val = phy_read(phydev, ET1011C_STATUS_REG);
> +		if (val < 0)
> +			return val;
> +
>  		if ((val & ET1011C_SPEED_MASK) ==
>  					ET1011C_GIGABIT_SPEED) {
>  			val = phy_read(phydev, ET1011C_CONFIG_REG);
> +			if (val < 0)
> +				return val;
> +
>  			val &= ~ET1011C_TX_FIFO_MASK;
>  			phy_write(phydev, ET1011C_CONFIG_REG, val |
>  					  ET1011C_GMII_INTERFACE |
>
>

[Severity: Medium]
With the new early returns, et1011c_read_status() updates the static
speed cache to phydev->speed before either phy_read() is attempted.

Suppose the read of ET1011C_STATUS_REG or ET1011C_CONFIG_REG fails
while the link comes up at 1000Mbps. We return the error without
programming ET1011C_CONFIG_REG, but speed already equals
phydev->speed. On the next poll the speed != phydev->speed test is
false, so the block is skipped. ET1011C_GMII_INTERFACE,
ET1011C_SYS_CLK_EN and ET1011C_TX_FIFO_DEPTH_16 are then never applied
for that gigabit link.

The error path in _phy_state_machine() does not help either. Entering
PHY_ERROR clears phydev->link but leaves phydev->speed alone, so a link
that comes back at the same speed will not retrigger the write.

Could speed be updated only after the reads (and ideally the
phy_write()) have succeeded, so that a transient MDIO error is retried
on the next poll? Or is there a reason the cache has to be set before
the register accesses?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115180735.649299-1-elias.pukari%40gmail.com

      parent reply	other threads:[~2026-11-16 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 18:07 [PATCH net-next v2] net: phy: et1011c: don't write an error code to the config register Elias Pukari
2026-11-15 18:24 ` Andrew Lunn
2026-11-16 18:59 ` netdev-bot+sashiko [this message]

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=179485554872.3136.2853572906945647083@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=elias.pukari@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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