[BUG] smctr.c changes in latest BK

From: Jochen Friedrich (jochen@scram.de)
Date: Thu Feb 13 2003 - 17:46:59 EST


Hi,

===== smctr.c 1.15 vs 1.16 =====
--- 1.15/drivers/net/tokenring/smctr.c Thu Nov 21 23:06:12 2002
+++ 1.16/drivers/net/tokenring/smctr.c Thu Feb 13 07:23:32 2003
@@ -3064,7 +3064,7 @@
         __u8 r;

         /* Check if node address has been specified by user. (non-0) */
- for(i = 0; ((i < 6) && (dev->dev_addr[i] == 0)); i++);
+ for(i = 0; ((i < 6) && (dev->dev_addr[i] == 0)); i++)
         {
                 if(i != 6)
                 {

Please revert this one as it is just wrong. As already mentioned here in
LKML (IIRC it was Alan), the semicolon is really intended here.

The above loop just runs until a non-zero byte is found in the MAC
address or all 6 bytes have been checked. A value of i=6 will then
indicate an all-zero MAC address.

However, the block following the for loop is completely unnecessary and
confusing. This patch just removes the irritating braces:

===== smctr.c 1.17 vs edited =====
--- 1.17/drivers/net/tokenring/smctr.c Thu Feb 13 22:47:11 2003
+++ edited/smctr.c Thu Feb 13 23:44:07 2003
@@ -3058,26 +3058,25 @@
         __u8 r;

         /* Check if node address has been specified by user. (non-0) */
- for(i = 0; ((i < 6) && (dev->dev_addr[i] == 0)); i++)
+ for(i = 0; ((i < 6) && (dev->dev_addr[i] == 0)); i++);
+
+ if(i != 6) /* Node addr is not 00:00:00:00:00:00 */
         {
- if(i != 6)
+ for(i = 0; i < 6; i++)
                 {
- for(i = 0; i < 6; i++)
- {
- r = inb(ioaddr + LAR0 + i);
- dev->dev_addr[i] = (char)r;
- }
- dev->addr_len = 6;
+ r = inb(ioaddr + LAR0 + i);
+ dev->dev_addr[i] = (char)r;
                 }
- else /* Node addr. not given by user, read it from board. */
+ dev->addr_len = 6;
+ }
+ else /* Node addr. not given by user, read it from board. */
+ {
+ for(i = 0; i < 6; i++)
                 {
- for(i = 0; i < 6; i++)
- {
- r = inb(ioaddr + LAR0 + i);
- dev->dev_addr[i] = (char)r;
- }
- dev->addr_len = 6;
+ r = inb(ioaddr + LAR0 + i);
+ dev->dev_addr[i] = (char)r;
                 }
+ dev->addr_len = 6;
         }

         return (0);

Thanks,
--jochen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:50 EST