Thread (4 messages) 4 messages, 3 authors, 2008-03-10

Re: drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

flat view

From: Roel Kluin <hidden>
Date: 2008-03-10 01:16:40
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Paul Gortmaker wrote:
quoted hunk ↗ jump to hunk
--- Roel Kluin <12o3l@tiscali.nl> wrote:
quoted
drivers/net/tokenring/smctr.c:3416

tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);

shouldn't this be a bit-wise or?
from drivers/net/tokenring/smctr.h:50:

#define      IBM_PASS_SOURCE_ADDR    0x01
Probably a safe bet that is what they meant to have. Since
as it stands, gcc will (correctly) optimize that into:

tsv->svv[0]= 1;

which probably isn't particularly useful.

Paul.
That was what I was thinking as well.
---
logical-bitwise | confusion

Signed-off-by: Roel Kluin <redacted>
---
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 8909050..8ae5837 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3413,7 +3413,7 @@ static int smctr_make_tx_status_code(struct net_device *dev,
         tsv->svi = TRANSMIT_STATUS_CODE;
         tsv->svl = S_TRANSMIT_STATUS_CODE;
 
-        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);
+        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) | IBM_PASS_SOURCE_ADDR);
 
         /* Stripped frame status of Transmitted Frame */
         tsv->svv[1] = tx_fstatus & 0xff;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help