From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Julien Aube <julien_dpdk@jaube.fr>,
Harish Patil <harish.patil@cavium.com>
Subject: [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup
Date: Tue, 12 Nov 2024 09:43:55 -0800 [thread overview]
Message-ID: <20241112174613.326565-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20241112174613.326565-1-stephen@networkplumber.org>
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@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
next prev parent reply other threads:[~2024-11-12 17:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
2024-11-12 17:43 ` [PATCH 1/4] net/bnx2x: remove dead conditional Stephen Hemminger
2024-11-12 17:43 ` [PATCH 2/4] net/bnx2x: fix always true expression Stephen Hemminger
2024-11-12 17:43 ` Stephen Hemminger [this message]
2024-11-12 17:43 ` [PATCH 4/4] net/bnx2x: fix duplicate branch Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241112174613.326565-4-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=harish.patil@cavium.com \
--cc=julien_dpdk@jaube.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).