Skip to contentSkip to conversation

pcmcia: pcnet_cs.c removing useless condition

RFC PATCH In review Jaswinder Singh Rajput 2 participants 2 messages Sep 12, 2009 – Sep 22, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 pcmcia: pcnet_cs.c removing useless condition

[This is untested]

'if (i < NR_INFO)' will only true if we breaks from 'for (i = 0; i < NR_INFO; i++)' So removing useless 'if (i < NR_INFO)'

This also fixed following compilation warning :

CC [M] drivers/net/pcmcia/pcnet_cs.o
drivers/net/pcmcia/pcnet_cs.c: In function ‘get_hwinfo’:
drivers/net/pcmcia/pcnet_cs.c:321: warning: ‘base’ may be used uninitialized in this function

---
 drivers/net/pcmcia/pcnet_cs.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/pcmcia/pcnet_cs.c +5 -6
index 9ef1c1b..6a60227 100644
@@ -339,12 +339,11 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
 	base = &virt[hw_info[i].offset & (req.Size-1)];
 	if ((readb(base+0) == hw_info[i].a0) &&
 	    (readb(base+2) == hw_info[i].a1) &&
-	    (readb(base+4) == hw_info[i].a2))
-	    break;
-    }
-    if (i < NR_INFO) {
-	for (j = 0; j < 6; j++)
-	    dev->dev_addr[j] = readb(base + (j<<1));
+	    (readb(base+4) == hw_info[i].a2)) {
+		for (j = 0; j < 6; j++)
+		    dev->dev_addr[j] = readb(base + (j<<1));
+		break;
+	}
     }
 
     iounmap(virt);
Signature · 1 line
1.6.4.2
maintainer
#1 lore raw

From: Jaswinder Singh Rajput <[email protected]>
Date: Sun, 13 Sep 2009 00:38:49 +0530

Quoted 5 lines

[This is untested]

'if (i < NR_INFO)' will only true if we breaks from 'for (i = 0; i < NR_INFO; i++)' So removing useless 'if (i < NR_INFO)'

Quoted 7 lines

This also fixed following compilation warning :

CC [M] drivers/net/pcmcia/pcnet_cs.o
drivers/net/pcmcia/pcnet_cs.c: In function ‘get_hwinfo’:
drivers/net/pcmcia/pcnet_cs.c:321: warning: ‘base’ may be used uninitialized in this function

Looks good to me, applied.