net: usb: lan78xx: Improve error handling in lan78xx_phy_wait_not_busy

Update `lan78xx_phy_wait_not_busy` to forward errors from
`lan78xx_read_reg` instead of overwriting them with `-EIO`. Replace
`-EIO` with `-ETIMEDOUT` for timeout cases, providing more specific and
appropriate error codes.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241209130751.703182-10-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Oleksij Rempel
2024-12-09 14:07:49 +01:00
committed by Jakub Kicinski
parent bf361b18d9
commit 21fff45a6c

View File

@@ -963,14 +963,14 @@ static int lan78xx_phy_wait_not_busy(struct lan78xx_net *dev)
do {
ret = lan78xx_read_reg(dev, MII_ACC, &val);
if (unlikely(ret < 0))
return -EIO;
if (ret < 0)
return ret;
if (!(val & MII_ACC_MII_BUSY_))
return 0;
} while (!time_after(jiffies, start_time + HZ));
return -EIO;
return -ETIMEDOUT;
}
static inline u32 mii_access(int id, int index, int read)