DPDK patches and discussions
 help / color / mirror / Atom feed
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 2/4] net/bnx2x: fix always true expression
Date: Tue, 12 Nov 2024 09:43:54 -0800	[thread overview]
Message-ID: <20241112174613.326565-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20241112174613.326565-1-stephen@networkplumber.org>

Coverity spotted that the check to enable single interrupt
mode would evaluate as always true since:

 The or condition sc->interrupt_mode != 2 || sc->interrupt_mode != 3
 will always be true because sc->interrupt_mode cannot be equal to
 two different values at the same time, so it must be not equal to
 at least one of them.

Coverity issue: 362046
Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 3153cc4d80..af31ac4604 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -11189,11 +11189,9 @@ static int bnx2x_init_hw_func(struct bnx2x_softc *sc)
 /* Turn on a single ISR mode in IGU if driver is going to use
  * INT#x or MSI
  */
-		if ((sc->interrupt_mode != INTR_MODE_MSIX)
-		    || (sc->interrupt_mode != INTR_MODE_SINGLE_MSIX)) {
+		if (sc->interrupt_mode == INTR_MODE_INTX ||
+		    sc->interrupt_mode == INTR_MODE_MSI)
 			pf_conf |= IGU_PF_CONF_SINGLE_ISR_EN;
-		}
-
 /*
  * Timers workaround bug: function init part.
  * Need to wait 20msec after initializing ILT,
-- 
2.45.2


  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 ` Stephen Hemminger [this message]
2024-11-12 17:43 ` [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup Stephen Hemminger
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-3-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).