Skip to contentSkip to conversation

net: rtl8169: Add initialized eth_device structure

PATCH New Nobuhiro Iwamatsu 2 participants 23 messages Oct 19, 2010 – Nov 14, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/10 net: rtl8169: Add initialized eth_device structure

rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/rtl8169.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/rtl8169.c +6 -1
index e45d1a5..d6bc514 100644
@@ -894,7 +894,12 @@ int rtl8169_initialize(bd_t *bis)
 		debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase);
 
 		dev = (struct eth_device *)malloc(sizeof *dev);
-
+		if (!dev) {
+			printf("Can not allocate memory of rtl8169\n");
+			break;
+		}
+			
+		memset(dev, 0, sizeof(*dev));
 		sprintf (dev->name, "RTL8169#%d", card_number);
 
 		dev->priv = (void *) devno;
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/10 net: rtl8169: Add initialized eth_device structure

Hi, Ben and Wolfgang.

Could you take in these patches?

Best regards,
Nobuhiro

2010/10/19 Nobuhiro Iwamatsu <[email protected]>:

Quoted 32 lines

rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
?drivers/net/rtl8169.c | ? ?7 ++++++-
?1 files changed, 6 insertions(+), 1 deletions(-)

drivers/net/rtl8169.c +6 -2
index e45d1a5..d6bc514 100644
@@ -894,7 +894,12 @@ int rtl8169_initialize(bd_t *bis)
 ? ? ? ? ? ? ? ?debug ("rtl8169: REALTEK RTL8169 @0x%x\n", iobase);
 
 ? ? ? ? ? ? ? ?dev = (struct eth_device *)malloc(sizeof *dev);
-
+ ? ? ? ? ? ? ? if (!dev) {
+ ? ? ? ? ? ? ? ? ? ? ? printf("Can not allocate memory of rtl8169\n");
+ ? ? ? ? ? ? ? ? ? ? ? break;
+ ? ? ? ? ? ? ? }
+
+ ? ? ? ? ? ? ? memset(dev, 0, sizeof(*dev));
 ? ? ? ? ? ? ? ?sprintf (dev->name, "RTL8169#%d", card_number);
 
 ? ? ? ? ? ? ? ?dev->priv = (void *) devno;
--

1.7.1

Signature · 3 lines
Nobuhiro Iwamatsu
?? iwamatsu at {nigauri.org / debian.org}
?? GPG ID: 40AD1FA6
#2 lore raw

PATCH v2 1/10 net: rtl8169: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 2 lines · In message <[email protected]> you…

Could you take in these patches?

Are these bug fixes, or can they wait for the "next" branch?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
One friend in a lifetime is much; two  are  many;  three  are  hardly
possible. Friendship needs a certain parallelism of life, a community
of thought, a rivalry of aim.                     - Henry Brook Adams
#3 lore raw

PATCH v2 1/10 net: rtl8169: Add initialized eth_device structure

Hi, Wolfgang.

2010/10/28 Wolfgang Denk <[email protected]>:

Quoted 7 lines

Dear Nobuhiro Iwamatsu,

Quoted 2 lines · In message <[email protected]> you…

Could you take in these patches?

Are these bug fixes, or can they wait for the "next" branch?

There are bug fix.
When we don't apply these patches, the board with the network device of the object does not work.

Best regards,
Nobuhiro

Signature · 3 lines
Nobuhiro Iwamatsu
?? iwamatsu at {nigauri.org / debian.org}
?? GPG ID: 40AD1FA6
#4 lore raw

PATCH v2 2/10 net: rtl8139: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

rtl8139 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/rtl8139.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/rtl8139.c +5 -0
index db8a727..c2779db 100644
@@ -220,6 +220,11 @@ int rtl8139_initialize(bd_t *bis)
 		debug ("rtl8139: REALTEK RTL8139 @0x%x\n", iobase);
 
 		dev = (struct eth_device *)malloc(sizeof *dev);
+		if (!dev) {
+			printf("Can not allocate memory of rtl8139\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 
 		sprintf (dev->name, "RTL8139#%d", card_number);
 
Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 2/10 net: rtl8139: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

rtl8139 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/rtl8139.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Real computer scientists despise the idea of actual  hardware.  Hard-
ware has limitations, software doesn't. It's a real shame that Turing
machines are so poor at I/O.
#6 lore raw

PATCH v2 3/10 net: dc2114x: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

dc2114x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/dc2114x.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/dc2114x.c +6 -0
index 5ae53e8..9fd0ec8 100644
@@ -279,6 +279,12 @@ int dc21x4x_initialize(bd_t *bis)
 		debug ("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
 
 		dev = (struct eth_device*) malloc(sizeof *dev);
+		
+		if (!dev) {
+			printf("Can not allocalte memory of dc21x4x\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 
 #ifdef CONFIG_TULIP_FIX_DAVICOM
 		sprintf(dev->name, "Davicom#%d", card_number);
Signature · 1 line
1.7.1
#7 lore raw

PATCH v2 3/10 net: dc2114x: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

dc2114x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/dc2114x.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
panic: kernel trap (ignored)
#8 lore raw

PATCH v2 4/10 net: eepro100: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

eepro100 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/eepro100.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/eepro100.c +5 -0
index 22e14e3..2d165af 100644
@@ -450,6 +450,11 @@ int eepro100_initialize (bd_t * bis)
 		}
 
 		dev = (struct eth_device *) malloc (sizeof *dev);
+		if (!dev) {
+			printf("eepro100: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 
 		sprintf (dev->name, "i82559#%d", card_number);
 		dev->priv = (void *) devno; /* this have to come before bus_to_phys() */
Signature · 1 line
1.7.1
#9 lore raw

PATCH v2 4/10 net: eepro100: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

eepro100 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/eepro100.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"A great many people think they are thinking when they are merely re-
arranging their prejudices."                          - William James
#10 lore raw

PATCH v2 5/10 net: fec_mxc: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

This prevents access to the member of eth_device which is not initialized.

---
 drivers/net/fec_mxc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/fec_mxc.c +1 -0
index 2d4ffed..071276e 100644
@@ -707,6 +707,7 @@ static int fec_probe(bd_t *bd)
 		puts("fec_mxc: not enough malloc memory\n");
 		return -ENOMEM;
 	}
+	memset(edev, 0, sizeof(*edev));
 	edev->priv = fec;
 	edev->init = fec_init;
 	edev->send = fec_send;
Signature · 1 line
1.7.1
#11 lore raw

PATCH v2 5/10 net: fec_mxc: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 7 lines · In message <[email protected]> you wrote:

This prevents access to the member of eth_device which is not initialized.

---
 drivers/net/fec_mxc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
On our campus the UNIX system has proved to be not only an  effective
software tool, but an agent of technical and social change within the
University.                          - John Lions (U. of Toronto (?))
#12 lore raw

PATCH v2 6/10 net: natsemi: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

natsemi driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/natsemi.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/natsemi.c +5 -0
index e09da1d..072ea3a 100644
@@ -321,6 +321,11 @@ natsemi_initialize(bd_t * bis)
 		}
 
 		dev = (struct eth_device *) malloc(sizeof *dev);
+		if (!dev) {
+			printf("natsemi: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 
 		sprintf(dev->name, "dp83815#%d", card_number);
 		dev->iobase = bus_to_phys(iobase);
Signature · 1 line
1.7.1
#13 lore raw

PATCH v2 6/10 net: natsemi: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

natsemi driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/natsemi.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The good Christian should beware of mathematicians and all those who
make empty prophecies. The danger already exists that  mathematicians
have  made a covenant with the devil to darken the spirit and confine
man in the bonds of Hell."                          - Saint Augustine
#14 lore raw

PATCH v2 7/10 net: ns8382x: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

ns8382x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/ns8382x.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/ns8382x.c +5 -0
index 198f73d..a5196bb 100644
@@ -340,6 +340,11 @@ ns8382x_initialize(bd_t * bis)
 		}
 
 		dev = (struct eth_device *) malloc(sizeof *dev);
+		if (!dev) {
+			printf("ns8382x: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 
 		sprintf(dev->name, "dp8382x#%d", card_number);
 		dev->iobase = bus_to_phys(iobase);
Signature · 1 line
1.7.1
#15 lore raw

PATCH v2 7/10 net: ns8382x: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

ns8382x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/ns8382x.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Steal five dollars and you were a petty  thief.  Steal  thousands  of
dollars and you are either a government or a hero.
                                   - Terry Pratchett, _Going_Postal_
#16 lore raw

PATCH v2 8/10 net: pcnet: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

pcnet driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/pcnet.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/pcnet.c +5 -0
index 99b6942..e994cb6 100644
@@ -187,6 +187,11 @@ int pcnet_initialize (bd_t * bis)
 		 * Allocate and pre-fill the device structure.
 		 */
 		dev = (struct eth_device *) malloc (sizeof *dev);
+		if (!dev) {
+			printf("pcnet: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 		dev->priv = (void *) devbusfn;
 		sprintf (dev->name, "pcnet#%d", dev_nr);
 
Signature · 1 line
1.7.1
#17 lore raw

PATCH v2 8/10 net: pcnet: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

pcnet driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/pcnet.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
READ THIS BEFORE OPENING PACKAGE: According to Certain Suggested Ver-
sions of the Grand Unified Theory, the Primary Particles Constituting
this Product May Decay to Nothingness Within the  Next  Four  Hundred
Million Years.
#18 lore raw

PATCH v2 9/10 net: tsi108_eth: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

tsi108_eth driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/tsi108_eth.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/tsi108_eth.c +5 -1
index 079354a..f100ec1 100644
@@ -731,7 +731,11 @@ int tsi108_eth_initialize (bd_t * bis)
 
 	for (index = 0; index < CONFIG_TSI108_ETH_NUM_PORTS; index++) {
 		dev = (struct eth_device *)malloc(sizeof(struct eth_device));
-
+		if (!dev) {
+			printf("tsi108: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 		sprintf (dev->name, "TSI108_eth%d", index);
 
 		dev->iobase = ETH_BASE + (index * ETH_PORT_OFFSET);
Signature · 1 line
1.7.1
#19 lore raw

PATCH v2 9/10 net: tsi108_eth: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

tsi108_eth driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/tsi108_eth.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I've finally learned what `upward compatible' means. It means we get
to keep all our old mistakes." - Dennie van Tassel
#20 lore raw

PATCH v2 10/10 net: uli526x: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

uli526x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/uli526x.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/uli526x.c +5 -0
index 56eee7b..fca5c09 100644
@@ -225,6 +225,11 @@ int uli526x_initialize(bd_t *bis)
 		iobase &= ~0xf;
 
 		dev = (struct eth_device *)malloc(sizeof *dev);
+		if (!dev) {
+			printf("uli526x: Can not allocate memory\n");
+			break;
+		}
+		memset(dev, 0, sizeof(*dev));
 		sprintf(dev->name, "uli526x#%d", card_number);
 		db = (struct uli526x_board_info *)
 			malloc(sizeof(struct uli526x_board_info));
Signature · 1 line
1.7.1
#21 lore raw

PATCH v2 10/10 net: uli526x: Add initialized eth_device structure

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

uli526x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/uli526x.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Speculation is always more interesting than facts.
                                    - Terry Pratchett, _Making_Money_
#22 lore raw

PATCH v2 1/10 net: rtl8169: Add initialized eth_device structure

In reply to Nobuhiro Iwamatsu

Dear Nobuhiro Iwamatsu,

Quoted 9 lines · In message <[email protected]> you wrote:

rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.

---
 drivers/net/rtl8169.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It is better for civilization to be going down the drain than to  be
coming up it."                                          - Henry Allen