Re: [PATCH net-next v2] net: phy: et1011c: don't write an error code to the config register

From: netdev-bot+sashiko

Date: Mon Nov 16 2026 - 13:59:30 EST


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