public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail•com>
To: jcliburn@gmail•com
Cc: atl1-devel@lists•sourceforge.net,
	Andrew Morton <akpm@linux-foundation•org>,
	netdev <netdev@vger•kernel.org>
Subject: [PATCH] atl1c: add missing parentheses
Date: Sun, 12 Jul 2009 23:40:34 +0200	[thread overview]
Message-ID: <4A5A5852.4010901@gmail.com> (raw)

Parentheses are required or the comparison occurs before the bitand.

Signed-off-by: Roel Kluin <roel.kluin@gmail•com>
---
#include <stdio.h>
int main()
{
        printf("0 & 1 == 0: %u\n", 0 & 1 == 0);
        printf("1 & 1 == 0: %u\n", 1 & 1 == 0);
        printf("(0 & 1) == 0: %u\n", (0 & 1) == 0);
        printf("(1 & 1) == 0: %u\n", (1 & 1) == 0);
        return 0;
}

output:
0 & 1 == 0: 0
1 & 1 == 0: 0
(0 & 1) == 0: 1
(1 & 1) == 0: 0

diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index e1658ef..2a1120a 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -188,14 +188,14 @@ struct atl1c_tpd_ext_desc {
 #define RRS_HDS_TYPE_DATA	2
 
 #define RRS_IS_NO_HDS_TYPE(flag) \
-	(((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == 0)
+	((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == 0)
 
 #define RRS_IS_HDS_HEAD(flag) \
-	(((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
+	((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
 			RRS_HDS_TYPE_HEAD)
 
 #define RRS_IS_HDS_DATA(flag) \
-	(((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK == \
+	((((flag) >> (RRS_HDS_TYPE_SHIFT)) & RRS_HDS_TYPE_MASK) == \
 			RRS_HDS_TYPE_DATA)
 
 /* rrs word 3 bit 0:31 */
@@ -245,7 +245,7 @@ struct atl1c_tpd_ext_desc {
 #define RRS_PACKET_TYPE_802_3  	1
 #define RRS_PACKET_TYPE_ETH	0
 #define RRS_PACKET_IS_ETH(word) \
-	(((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK == \
+	((((word) >> RRS_PACKET_TYPE_SHIFT) & RRS_PACKET_TYPE_MASK) == \
 			RRS_PACKET_TYPE_ETH)
 #define RRS_RXD_IS_VALID(word) \
 	((((word) >> RRS_RXD_UPDATED_SHIFT) & RRS_RXD_UPDATED_MASK) == 1)

             reply	other threads:[~2009-07-12 21:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-12 21:40 Roel Kluin [this message]
2009-07-12 21:40 ` [PATCH] atl1c: add missing parentheses David Miller
2009-07-13  0:08 ` J. K. Cliburn
2009-07-17  1:08 ` David Miller

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=4A5A5852.4010901@gmail.com \
    --to=roel.kluin@gmail$(echo .)com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=atl1-devel@lists$(echo .)sourceforge.net \
    --cc=jcliburn@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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