All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] pcmcia: pcnet_cs.c removing useless condition
@ 2009-09-12 19:08 Jaswinder Singh Rajput
  2009-09-22 21:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jaswinder Singh Rajput @ 2009-09-12 19:08 UTC (permalink / raw)
  To: David Miller, Jeff Garzik, netdev, linux-pcmcia, Dominik Brodowski

[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

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 drivers/net/pcmcia/pcnet_cs.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 9ef1c1b..6a60227 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -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);
-- 
1.6.4.2



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

* Re: [RFC][PATCH] pcmcia: pcnet_cs.c removing useless condition
  2009-09-12 19:08 [RFC][PATCH] pcmcia: pcnet_cs.c removing useless condition Jaswinder Singh Rajput
@ 2009-09-22 21:17 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-09-22 21:17 UTC (permalink / raw)
  To: jaswinder; +Cc: jeff, netdev, linux-pcmcia, linux

From: Jaswinder Singh Rajput <jaswinder@kernel.org>
Date: Sun, 13 Sep 2009 00:38:49 +0530

> [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
> 
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>

Looks good to me, applied.

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

end of thread, other threads:[~2009-09-22 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-12 19:08 [RFC][PATCH] pcmcia: pcnet_cs.c removing useless condition Jaswinder Singh Rajput
2009-09-22 21:17 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.