2013-05-17 15:18:37

by Emilio López

[permalink] [raw]
Subject: [PATCH 1/4] net: ethernet: sun: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

Please note that this patch is untested.

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


2013-05-17 15:18:45

by Emilio López

[permalink] [raw]
Subject: [PATCH 2/4] net: ethernet: apple: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 15:18:51

by Emilio López

[permalink] [raw]
Subject: [PATCH 3/4] net: ethernet: davicom: dm9000: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 15:19:08

by Emilio López

[permalink] [raw]
Subject: [PATCH 4/4] net: ethernet: korina: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 20:23:15

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 1/4] net: ethernet: sun: initialize variables directly

From: Emilio L?pez <[email protected]>
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 <[email protected]>

Poorly styled, should be:

u16 hash_table[4] = { 0 };

2013-05-17 20:23:39

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/4] net: ethernet: apple: initialize variables directly

From: Emilio L?pez <[email protected]>
Date: Fri, 17 May 2013 12:07:46 -0300

> Clean up the code a bit to initialize the variables directly when
> defining them.
>
> Signed-off-by: Emilio L?pez <[email protected]>

Same problem as patch one, poorly styled, please fix these
problems and resubmit the entire series.

2013-05-17 20:45:52

by Emilio López

[permalink] [raw]
Subject: [PATCH v2 1/4] net: ethernet: sun: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 20:46:07

by Emilio López

[permalink] [raw]
Subject: [PATCH v2 2/4] net: ethernet: apple: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 20:46:15

by Emilio López

[permalink] [raw]
Subject: [PATCH v2 3/4] net: ethernet: davicom: dm9000: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 20:46:27

by Emilio López

[permalink] [raw]
Subject: [PATCH v2 4/4] net: ethernet: korina: initialize variables directly

Clean up the code a bit to initialize the variables directly when
defining them.

Signed-off-by: Emilio López <[email protected]>
---

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

2013-05-17 20:59:25

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] net: ethernet: sun: initialize variables directly

From: Emilio L?pez <[email protected]>
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 <[email protected]>

Applied.

2013-05-17 20:59:32

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] net: ethernet: apple: initialize variables directly

From: Emilio L?pez <[email protected]>
Date: Fri, 17 May 2013 17:42:54 -0300

> Clean up the code a bit to initialize the variables directly when
> defining them.
>
> Signed-off-by: Emilio L?pez <[email protected]>

Applied.

2013-05-17 20:59:45

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] net: ethernet: korina: initialize variables directly

From: Emilio L?pez <[email protected]>
Date: Fri, 17 May 2013 17:42:56 -0300

> Clean up the code a bit to initialize the variables directly when
> defining them.
>
> Signed-off-by: Emilio L?pez <[email protected]>

Applied.