* [PATCH net] tg3: Propagate PHY reset retry failures in tg3_phy_reset_5703_4_5()
@ 2026-11-19 17:10 Ian Rogers
0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-19 17:10 UTC (permalink / raw)
To: Pavan Chebbi, Michael Chan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, llvm, Elkin Cruz, Ian Rogers
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, phy9_orig is never initialized before being written back to
MII_CTRL1000; if tg3_phy_write_and_check_testpat() fails across all 10
retries, the function silently continues as if the PHY test pattern
succeeded.
Record err on both tg3_readphy() calls and return err if the retry
loop finishes with an error.
Found via Clang -Wconditional-uninitialized on an x86_64 allyesconfig
build. Verified by building drivers/net/ethernet/broadcom/tg3.o with
LLVM=1 W=1 (-Werror) and -Wconditional-uninitialized; not
runtime-tested on BCM5703/5704/5705 hardware.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ian Rogers <irogers@google.com>
---
drivers/net/ethernet/broadcom/tg3.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 95827df4cf6a..be2410e718fd 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2558,7 +2558,8 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
}
/* Disable transmitter and interrupt. */
- if (tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32))
+ err = tg3_readphy(tp, MII_TG3_EXT_CTRL, ®32);
+ if (err)
continue;
reg32 |= 0x3000;
@@ -2569,7 +2570,8 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
BMCR_FULLDPLX | BMCR_SPEED1000);
/* Set to master mode. */
- if (tg3_readphy(tp, MII_CTRL1000, &phy9_orig))
+ err = tg3_readphy(tp, MII_CTRL1000, &phy9_orig);
+ if (err)
continue;
tg3_writephy(tp, MII_CTRL1000,
@@ -2587,6 +2589,9 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
break;
} while (--retries);
+ if (err)
+ return err;
+
err = tg3_phy_reset_chanpat(tp);
if (err)
return err;
--
2.56.1.708.g77570a6a1d-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-19 17:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:10 [PATCH net] tg3: Propagate PHY reset retry failures in tg3_phy_reset_5703_4_5() Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®