* [PATCH 2/4] net: ethernet: apple: initialize variables directly
2013-05-17 15:07 [PATCH 1/4] net: ethernet: sun: initialize variables directly Emilio López
@ 2013-05-17 15:07 ` Emilio López
2013-05-17 20:23 ` David Miller
2013-05-17 15:07 ` [PATCH 3/4] net: ethernet: davicom: dm9000: " Emilio López
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Emilio López @ 2013-05-17 15:07 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
drivers/net/ethernet/apple/bmac.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index f36bbd6..253030c 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1030,14 +1030,12 @@ static void bmac_set_multicast(struct net_device *dev)
rx_cfg |= RxPromiscEnable;
bmwrite(dev, RXCFG, rx_cfg);
} else {
- u16 hash_table[4];
+ u16 hash_table[4] = {0};
rx_cfg = bmread(dev, RXCFG);
rx_cfg &= ~RxPromiscEnable;
bmwrite(dev, RXCFG, rx_cfg);
- for(i = 0; i < 4; i++) hash_table[i] = 0;
-
netdev_for_each_mc_addr(ha, dev) {
crc = ether_crc_le(6, ha->addr);
crc >>= 26;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 3/4] net: ethernet: davicom: dm9000: initialize variables directly
2013-05-17 15:07 [PATCH 1/4] net: ethernet: sun: initialize variables directly Emilio López
2013-05-17 15:07 ` [PATCH 2/4] net: ethernet: apple: " Emilio López
@ 2013-05-17 15:07 ` Emilio López
2013-05-17 15:07 ` [PATCH 4/4] net: ethernet: korina: " Emilio López
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Emilio López @ 2013-05-17 15:07 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
drivers/net/ethernet/davicom/dm9000.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 9105465..e4ed05e 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -827,7 +827,7 @@ dm9000_hash_table_unlocked(struct net_device *dev)
struct netdev_hw_addr *ha;
int i, oft;
u32 hash_val;
- u16 hash_table[4];
+ u16 hash_table[4] = {0, 0, 0, 0x8000}; /* broadcast address */
u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN;
dm9000_dbg(db, 1, "entering %s\n", __func__);
@@ -835,13 +835,6 @@ dm9000_hash_table_unlocked(struct net_device *dev)
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
iow(db, oft, dev->dev_addr[i]);
- /* Clear Hash Table */
- for (i = 0; i < 4; i++)
- hash_table[i] = 0x0;
-
- /* broadcast address */
- hash_table[3] = 0x8000;
-
if (dev->flags & IFF_PROMISC)
rcr |= RCR_PRMSC;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 4/4] net: ethernet: korina: initialize variables directly
2013-05-17 15:07 [PATCH 1/4] net: ethernet: sun: initialize variables directly Emilio López
2013-05-17 15:07 ` [PATCH 2/4] net: ethernet: apple: " Emilio López
2013-05-17 15:07 ` [PATCH 3/4] net: ethernet: davicom: dm9000: " Emilio López
@ 2013-05-17 15:07 ` Emilio López
2013-05-17 20:23 ` [PATCH 1/4] net: ethernet: sun: " David Miller
2013-05-17 20:42 ` [PATCH v2 " Emilio López
4 siblings, 0 replies; 14+ messages in thread
From: Emilio López @ 2013-05-17 15:07 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
drivers/net/ethernet/korina.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 5409fe8..3756d95 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -495,12 +495,9 @@ static void korina_multicast_list(struct net_device *dev)
/* Build the hash table */
if (netdev_mc_count(dev) > 4) {
- u16 hash_table[4];
+ u16 hash_table[4] = {0};
u32 crc;
- for (i = 0; i < 4; i++)
- hash_table[i] = 0;
-
netdev_for_each_mc_addr(ha, dev) {
crc = ether_crc_le(6, ha->addr);
crc >>= 26;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH 1/4] net: ethernet: sun: initialize variables directly
2013-05-17 15:07 [PATCH 1/4] net: ethernet: sun: initialize variables directly Emilio López
` (2 preceding siblings ...)
2013-05-17 15:07 ` [PATCH 4/4] net: ethernet: korina: " Emilio López
@ 2013-05-17 20:23 ` David Miller
2013-05-17 20:42 ` [PATCH v2 " Emilio López
4 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2013-05-17 20:23 UTC (permalink / raw)
To: emilio; +Cc: netdev, linux-kernel
From: Emilio López <emilio@elopez.com.ar>
Date: Fri, 17 May 2013 12:07:45 -0300
> Clean up the code a bit to initialize the variables directly when
> defining them.
>
> Signed-off-by: Emilio López <emilio@elopez.com.ar>
Poorly styled, should be:
u16 hash_table[4] = { 0 };
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v2 1/4] net: ethernet: sun: initialize variables directly
2013-05-17 15:07 [PATCH 1/4] net: ethernet: sun: initialize variables directly Emilio López
` (3 preceding siblings ...)
2013-05-17 20:23 ` [PATCH 1/4] net: ethernet: sun: " David Miller
@ 2013-05-17 20:42 ` Emilio López
2013-05-17 20:42 ` [PATCH v2 2/4] net: ethernet: apple: " Emilio López
` (3 more replies)
4 siblings, 4 replies; 14+ messages in thread
From: Emilio López @ 2013-05-17 20:42 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
Changes from v1:
- {0} -> { 0 } as suggested by David Miller
drivers/net/ethernet/sun/sunbmac.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
index 0549759..aabb40a 100644
--- a/drivers/net/ethernet/sun/sunbmac.c
+++ b/drivers/net/ethernet/sun/sunbmac.c
@@ -1017,10 +1017,7 @@ static void bigmac_set_multicast(struct net_device *dev)
tmp |= BIGMAC_RXCFG_PMISC;
sbus_writel(tmp, bregs + BMAC_RXCFG);
} else {
- u16 hash_table[4];
-
- for (i = 0; i < 4; i++)
- hash_table[i] = 0;
+ u16 hash_table[4] = { 0 };
netdev_for_each_mc_addr(ha, dev) {
crc = ether_crc_le(6, ha->addr);
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v2 2/4] net: ethernet: apple: initialize variables directly
2013-05-17 20:42 ` [PATCH v2 " Emilio López
@ 2013-05-17 20:42 ` Emilio López
2013-05-17 20:59 ` David Miller
2013-05-17 20:42 ` [PATCH v2 3/4] net: ethernet: davicom: dm9000: " Emilio López
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Emilio López @ 2013-05-17 20:42 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
Changes from v1:
- {0} -> { 0 } as suggested by David Miller
drivers/net/ethernet/apple/bmac.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index f36bbd6..253030c 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1030,14 +1030,12 @@ static void bmac_set_multicast(struct net_device *dev)
rx_cfg |= RxPromiscEnable;
bmwrite(dev, RXCFG, rx_cfg);
} else {
- u16 hash_table[4];
+ u16 hash_table[4] = { 0 };
rx_cfg = bmread(dev, RXCFG);
rx_cfg &= ~RxPromiscEnable;
bmwrite(dev, RXCFG, rx_cfg);
- for(i = 0; i < 4; i++) hash_table[i] = 0;
-
netdev_for_each_mc_addr(ha, dev) {
crc = ether_crc_le(6, ha->addr);
crc >>= 26;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v2 3/4] net: ethernet: davicom: dm9000: initialize variables directly
2013-05-17 20:42 ` [PATCH v2 " Emilio López
2013-05-17 20:42 ` [PATCH v2 2/4] net: ethernet: apple: " Emilio López
@ 2013-05-17 20:42 ` Emilio López
2013-05-17 20:59 ` David Miller
2013-05-17 20:42 ` [PATCH v2 4/4] net: ethernet: korina: " Emilio López
2013-05-17 20:59 ` [PATCH v2 1/4] net: ethernet: sun: " David Miller
3 siblings, 1 reply; 14+ messages in thread
From: Emilio López @ 2013-05-17 20:42 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
Changes from v1:
- {0} -> { 0 } as suggested by David Miller
drivers/net/ethernet/davicom/dm9000.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index 9105465..e4ed05e 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -827,7 +827,7 @@ dm9000_hash_table_unlocked(struct net_device *dev)
struct netdev_hw_addr *ha;
int i, oft;
u32 hash_val;
- u16 hash_table[4];
+ u16 hash_table[4] = { 0, 0, 0, 0x8000 }; /* broadcast address */
u8 rcr = RCR_DIS_LONG | RCR_DIS_CRC | RCR_RXEN;
dm9000_dbg(db, 1, "entering %s\n", __func__);
@@ -835,13 +835,6 @@ dm9000_hash_table_unlocked(struct net_device *dev)
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
iow(db, oft, dev->dev_addr[i]);
- /* Clear Hash Table */
- for (i = 0; i < 4; i++)
- hash_table[i] = 0x0;
-
- /* broadcast address */
- hash_table[3] = 0x8000;
-
if (dev->flags & IFF_PROMISC)
rcr |= RCR_PRMSC;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v2 4/4] net: ethernet: korina: initialize variables directly
2013-05-17 20:42 ` [PATCH v2 " Emilio López
2013-05-17 20:42 ` [PATCH v2 2/4] net: ethernet: apple: " Emilio López
2013-05-17 20:42 ` [PATCH v2 3/4] net: ethernet: davicom: dm9000: " Emilio López
@ 2013-05-17 20:42 ` Emilio López
2013-05-17 20:59 ` David Miller
2013-05-17 20:59 ` [PATCH v2 1/4] net: ethernet: sun: " David Miller
3 siblings, 1 reply; 14+ messages in thread
From: Emilio López @ 2013-05-17 20:42 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Emilio López
Clean up the code a bit to initialize the variables directly when
defining them.
Signed-off-by: Emilio López <emilio@elopez.com.ar>
---
Please note that this patch is untested.
Changes from v1:
- {0} -> { 0 } as suggested by David Miller
drivers/net/ethernet/korina.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 5409fe8..3756d95 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -495,12 +495,9 @@ static void korina_multicast_list(struct net_device *dev)
/* Build the hash table */
if (netdev_mc_count(dev) > 4) {
- u16 hash_table[4];
+ u16 hash_table[4] = { 0 };
u32 crc;
- for (i = 0; i < 4; i++)
- hash_table[i] = 0;
-
netdev_for_each_mc_addr(ha, dev) {
crc = ether_crc_le(6, ha->addr);
crc >>= 26;
--
1.8.2.3
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2 1/4] net: ethernet: sun: initialize variables directly
2013-05-17 20:42 ` [PATCH v2 " Emilio López
` (2 preceding siblings ...)
2013-05-17 20:42 ` [PATCH v2 4/4] net: ethernet: korina: " Emilio López
@ 2013-05-17 20:59 ` David Miller
3 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2013-05-17 20:59 UTC (permalink / raw)
To: emilio; +Cc: netdev, linux-kernel
From: Emilio López <emilio@elopez.com.ar>
Date: Fri, 17 May 2013 17:42:53 -0300
> Clean up the code a bit to initialize the variables directly when
> defining them.
>
> Signed-off-by: Emilio López <emilio@elopez.com.ar>
Applied.
^ permalink raw reply [flat|nested] 14+ messages in thread