netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] vxge: remove duplicated part of check
@ 2010-12-24  6:15 Dan Carpenter
  2010-12-24  9:34 ` Julia Lawall
  2010-12-28 21:51 ` [patch] vxge: remove duplicated part of check {nodisc} Ramkrishna Vepa
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-12-24  6:15 UTC (permalink / raw)
  To: Ramkrishna Vepa
  Cc: Sivakumar Subramani, Sreenivasa Honnur, Jon Mason, netdev,
	kernel-janitors

This is just a cleanup to make the static checkers happy.  We don't need
to check "own" twice.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c
index 42cc298..4c10d6c 100644
--- a/drivers/net/vxge/vxge-traffic.c
+++ b/drivers/net/vxge/vxge-traffic.c
@@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
 	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
 
 	/* check whether it is not the end */
-	if (!own || ((*t_code == VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
+	if (!own || *t_code == VXGE_HW_RING_T_CODE_FRM_DROP) {
 
 		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control !=
 				0);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] vxge: remove duplicated part of check
  2010-12-24  6:15 [patch] vxge: remove duplicated part of check Dan Carpenter
@ 2010-12-24  9:34 ` Julia Lawall
  2010-12-28 21:51 ` [patch] vxge: remove duplicated part of check {nodisc} Ramkrishna Vepa
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2010-12-24  9:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ramkrishna Vepa, Sivakumar Subramani, Sreenivasa Honnur,
	Jon Mason, netdev, kernel-janitors

On Fri, 24 Dec 2010, Dan Carpenter wrote:

> This is just a cleanup to make the static checkers happy.  We don't need
> to check "own" twice.

It's indeed probably pretty pointless to put if (!A || (B && A)) because 
then B, which may rely on A being true, has already occurred.  Would 
anyone find if (!A || (A && B)) to be useful for readability?  I found 
20-some other occurrences, mostly of the latter type.

julia


> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c
> index 42cc298..4c10d6c 100644
> --- a/drivers/net/vxge/vxge-traffic.c
> +++ b/drivers/net/vxge/vxge-traffic.c
> @@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
>  	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
>  
>  	/* check whether it is not the end */
> -	if (!own || ((*t_code == VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
> +	if (!own || *t_code == VXGE_HW_RING_T_CODE_FRM_DROP) {
>  
>  		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control !=
>  				0);
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [patch] vxge: remove duplicated part of check {nodisc}
  2010-12-24  6:15 [patch] vxge: remove duplicated part of check Dan Carpenter
  2010-12-24  9:34 ` Julia Lawall
@ 2010-12-28 21:51 ` Ramkrishna Vepa
  1 sibling, 0 replies; 3+ messages in thread
From: Ramkrishna Vepa @ 2010-12-28 21:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sivakumar Subramani, Sreenivasa Honnur, Jon Mason,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org

> This is just a cleanup to make the static checkers happy.  We don't need
> to check "own" twice.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-
> traffic.c
> index 42cc298..4c10d6c 100644
> --- a/drivers/net/vxge/vxge-traffic.c
> +++ b/drivers/net/vxge/vxge-traffic.c
> @@ -1240,7 +1240,7 @@ enum vxge_hw_status vxge_hw_ring_rxd_next_completed(
>  	*t_code	= (u8)VXGE_HW_RING_RXD_T_CODE_GET(control_0);
> 
>  	/* check whether it is not the end */
> -	if (!own || ((*t_code == VXGE_HW_RING_T_CODE_FRM_DROP) && own)) {
> +	if (!own || *t_code == VXGE_HW_RING_T_CODE_FRM_DROP) {
> 
>  		vxge_assert(((struct vxge_hw_ring_rxd_1 *)rxdp)->host_control
> !=
>  				0);
Looks good, thanks.

Acked-by: Ram Vepa <ram.vepa@exar.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-28 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-24  6:15 [patch] vxge: remove duplicated part of check Dan Carpenter
2010-12-24  9:34 ` Julia Lawall
2010-12-28 21:51 ` [patch] vxge: remove duplicated part of check {nodisc} Ramkrishna Vepa

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).