Subject: Re: [PATCH] sungem: remove superfluous variable

From: Joe Perches <[email-masked]>
Date: Wed, 20 Feb 2008 11:09:27 -0800

On Wed, 2008-02-20 at 12:37 +0100, Johannes Berg wrote:
> There's no need to have two variables called 'i' when one
> suffices.

Additional minor cleanups: tabs and style

Signed-off-by: Joe Perches <[email-masked]>

diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 9721279..8d52d20 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1817,24 +1817,22 @@ static void gem_init_dma(struct gem *gp)
 /* Must be invoked under gp->lock and gp->tx_lock. */
 static u32 gem_setup_multicast(struct gem *gp)
 {
-	u32 rxcfg = 0;
+	u32 rxcfg;
 	int i;
 
 	if ((gp->dev->flags & IFF_ALLMULTI) ||
 	    (gp->dev->mc_count > 256)) {
-	    	for (i=0; i<16; i++)
+		for (i = 0; i < 16; i++)
 			writel(0xffff, gp->regs + MAC_HASH0 + (i << 2));
-		rxcfg |= MAC_RXCFG_HFE;
+		rxcfg = MAC_RXCFG_HFE;
 	} else if (gp->dev->flags & IFF_PROMISC) {
-		rxcfg |= MAC_RXCFG_PROM;
+		rxcfg = MAC_RXCFG_PROM;
 	} else {
 		u16 hash_table[16];
 		u32 crc;
 		struct dev_mc_list *dmi = gp->dev->mc_list;
-		int i;
 
-		for (i = 0; i < 16; i++)
-			hash_table[i] = 0;
+		memset(hash_table, 0, sizeof(hash_table));
 
 		for (i = 0; i < gp->dev->mc_count; i++) {
 			char *addrs = dmi->dmi_addr;
@@ -1844,13 +1842,13 @@ static u32 gem_setup_multicast(struct gem *gp)
 			if (!(*addrs & 1))
 				continue;
 
- 			crc = ether_crc_le(6, addrs);
+			crc = ether_crc_le(6, addrs);
 			crc >>= 24;
 			hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
 		}
-	    	for (i=0; i<16; i++)
+		for (i = 0; i < ARRAY_SIZE(hash_table); i++)
 			writel(hash_table[i], gp->regs + MAC_HASH0 + (i << 2));
-		rxcfg |= MAC_RXCFG_HFE;
+		rxcfg = MAC_RXCFG_HFE;
 	}
 
 	return rxcfg;