Patchwork [net-next] bnx2x: align define usage to satisfy static checkers

login
register
mail settings
Submitter Ariel Elior
Date Jan. 9, 2013, 5:04 p.m.
Message ID <1357751075-23112-1-git-send-email-ariele@broadcom.com>
Download mbox | patch
Permalink /patch/210773/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ariel Elior - Jan. 9, 2013, 5:04 p.m.
Static checkers complained that the E1H_FUNC_MAX define is used
incorrectly in bnx2x_pretend_func(). The complaint was justified,
although its not a real bug, as the first part of the conditional
protects us in this case (a real bug would happen if a VF tried to
use the pretend func, but there are no VFs in E1H chips).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - Jan. 10, 2013, 10:40 p.m.
From: "Ariel Elior" <ariele@broadcom.com>
Date: Wed, 9 Jan 2013 19:04:35 +0200

> Static checkers complained that the E1H_FUNC_MAX define is used
> incorrectly in bnx2x_pretend_func(). The complaint was justified,
> although its not a real bug, as the first part of the conditional
> protects us in this case (a real bug would happen if a VF tried to
> use the pretend func, but there are no VFs in E1H chips).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ariel Elior <ariele@broadcom.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 5fcaee1..8740b52 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13361,7 +13361,7 @@  int bnx2x_pretend_func(struct bnx2x *bp, u16 pretend_func_val)
 {
 	u32 pretend_reg;
 
-	if (CHIP_IS_E1H(bp) && pretend_func_val > E1H_FUNC_MAX)
+	if (CHIP_IS_E1H(bp) && pretend_func_val >= E1H_FUNC_MAX)
 		return -1;
 
 	/* get my own pretend register */