[PATCH 3/4] net/bnx2x: fix possible infinite loop at startup
Stephen Hemminger
stephen at networkplumber.org
Tue Nov 12 18:43:55 CET 2024
Coverity spotted that one of the loop conditions was always true.
Fix by initializing the variable using same logic as Linux
kernel driver.
Coverity issue: 362057
Fixes: 540a211084a7 ("bnx2x: driver core")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/bnx2x/bnx2x.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index af31ac4604..d96fcb55c9 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -10331,12 +10331,13 @@ static int bnx2x_init_hw_common(struct bnx2x_softc *sc)
REG_WR(sc, PXP2_REG_RD_DISABLE_INPUTS, 0);
if (!CHIP_IS_E1x(sc)) {
- int factor = 0;
+ int factor = CHIP_REV_IS_EMUL(sc) ? 1000 :
+ (CHIP_REV_IS_FPGA(sc) ? 400 : 0);
ecore_init_block(sc, BLOCK_PGLUE_B, PHASE_COMMON);
ecore_init_block(sc, BLOCK_ATC, PHASE_COMMON);
-/* let the HW do it's magic... */
+ /* let the HW do it's magic... */
do {
DELAY(200000);
val = REG_RD(sc, ATC_REG_ATC_INIT_DONE);
--
2.45.2
More information about the dev
mailing list