Re: [PATCH net] tg3: Propagate PHY reset retry failures in tg3_phy_reset_5703_4_5()

From: Ian Rogers

Date: Fri Nov 20 2026 - 12:16:40 EST


On Thu, Nov 19, 2026 at 12:15 PM Andrew Lunn <andrew@xxxxxxx> wrote:
>
> On Thu, Nov 19, 2026 at 09:10:21AM -0800, Ian Rogers wrote:
> > In tg3_phy_reset_5703_4_5(), the 10-iteration retry loop discards the
> > return value of both tg3_readphy() calls on continue and never checks
> > err after the loop terminates. If MDIO reads fail across all 10
> > retries,
>
> If it fails 10 times, the hardware is dead, and there is no
> recovery. The best you can do is make the probe fail.

Agreed - propagating err out of tg3_phy_reset_5703_4_5() does make
probe fail via:

tg3_init_one() -> tg3_get_invariants() -> tg3_phy_probe() -> tg3_phy_reset()

rather than falling through and passing an uninitialized phy9_orig to
tg3_writephy() (which is an 'i32 noundef' UB in Clang -O2 IR when
CONFIG_INIT_STACK_NONE=y).

> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>
> This clearly does not bother anybody.
>
> https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

Fair point - sending this as [PATCH net] with Fixes: for stable was
wrong. The motivation is cleaning up Clang -Wconditional-uninitialized
warnings across allyesconfig so the warning can eventually be enabled.

Would you take this for net-next without the Fixes: tag (or a minimal
'phy9_orig = 0' initialization if you prefer not touching the old
control flow), or would you rather leave tg3 alone?

Thanks,
Ian

> Andrew
>