Patchwork vxge: Fix wrong boolean operator

login
register
mail settings
Submitter Stefan Weil
Date Jan. 28, 2011, 10:30 p.m.
Message ID <1296253817-7668-1-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/80899/
State Accepted
Delegated to: David Miller
Headers show

Comments

Stefan Weil - Jan. 28, 2011, 10:30 p.m.
This error is reported by cppcheck:
drivers/net/vxge/vxge-config.c:3693: warning: Mutual exclusion over || always evaluates to true. Did you intend to use && instead?

It looks like cppcheck is correct, so fix this. No test was run.

Cc: Ramkrishna Vepa <ramkrishna.vepa@exar.com>
Cc: Sivakumar Subramani <sivakumar.subramani@exar.com>
Cc: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
Cc: Jon Mason <jon.mason@exar.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 drivers/net/vxge/vxge-config.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - Feb. 1, 2011, 4:55 a.m.
From: Stefan Weil <weil@mail.berlios.de>
Date: Fri, 28 Jan 2011 23:30:17 +0100

> This error is reported by cppcheck:
> drivers/net/vxge/vxge-config.c:3693: warning: Mutual exclusion over || always evaluates to true. Did you intend to use && instead?
> 
> It looks like cppcheck is correct, so fix this. No test was run.
> 
> Cc: Ramkrishna Vepa <ramkrishna.vepa@exar.com>
> Cc: Sivakumar Subramani <sivakumar.subramani@exar.com>
> Cc: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
> Cc: Jon Mason <jon.mason@exar.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Can the VXGE folks please review this patch?

--
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
Ramkrishna Vepa - Feb. 1, 2011, 7:26 a.m.
> This error is reported by cppcheck:
> drivers/net/vxge/vxge-config.c:3693: warning: Mutual exclusion over ||
> always evaluates to true. Did you intend to use && instead?
> 
> It looks like cppcheck is correct, so fix this. No test was run.
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  drivers/net/vxge/vxge-config.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-
> config.c
> index 01c05f5..228d4f7 100644
> --- a/drivers/net/vxge/vxge-config.c
> +++ b/drivers/net/vxge/vxge-config.c
> @@ -3690,7 +3690,7 @@ __vxge_hw_vpath_rts_table_get(struct
> __vxge_hw_vpath_handle *vp,
>  	if (status != VXGE_HW_OK)
>  		goto exit;
> 
> -	if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA)
> ||
> +	if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA)
> &&
>  	    (rts_table !=
>  	     VXGE_HW_RTS_ACS_STEER_CTRL_DATA_STRUCT_SEL_RTH_MULTI_IT))
>  		*data1 = 0;
> --
Fix looks good. Thanks!

Acked-by: Ram Vepa <ram.vepa@exar.com>
--
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
David Miller - Feb. 1, 2011, 8:30 p.m.
From: Ramkrishna Vepa <Ramkrishna.Vepa@exar.com>
Date: Mon, 31 Jan 2011 23:26:40 -0800

>> This error is reported by cppcheck:
>> drivers/net/vxge/vxge-config.c:3693: warning: Mutual exclusion over ||
>> always evaluates to true. Did you intend to use && instead?
>> 
>> It looks like cppcheck is correct, so fix this. No test was run.
>> 
>> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
...
> Fix looks good. Thanks!
> 
> Acked-by: Ram Vepa <ram.vepa@exar.com>

Thanks for reviewing, 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/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 01c05f5..228d4f7 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -3690,7 +3690,7 @@  __vxge_hw_vpath_rts_table_get(struct __vxge_hw_vpath_handle *vp,
 	if (status != VXGE_HW_OK)
 		goto exit;
 
-	if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA) ||
+	if ((rts_table != VXGE_HW_RTS_ACCESS_STEER_CTRL_DATA_STRUCT_SEL_DA) &&
 	    (rts_table !=
 	     VXGE_HW_RTS_ACS_STEER_CTRL_DATA_STRUCT_SEL_RTH_MULTI_IT))
 		*data1 = 0;