[U-Boot] [PATCH 01/10 v2] 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/rtl8169.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index e45d1a5..d6bc514 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -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;

rtl8139 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/rtl8139.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index db8a727..c2779db 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-2-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/rtl8139.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

dc2114x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/dc2114x.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c index 5ae53e8..9fd0ec8 100644 --- a/drivers/net/dc2114x.c +++ b/drivers/net/dc2114x.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-3-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/dc2114x.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

eepro100 driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/eepro100.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 22e14e3..2d165af 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -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() */

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-4-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/eepro100.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

This prevents access to the member of eth_device which is not initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/fec_mxc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index 2d4ffed..071276e 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -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;

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-5-git-send-email-iwamatsu@nigauri.org you wrote:
This prevents access to the member of eth_device which is not initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/fec_mxc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

natsemi driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/natsemi.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index e09da1d..072ea3a 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-6-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/natsemi.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

ns8382x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/ns8382x.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c index 198f73d..a5196bb 100644 --- a/drivers/net/ns8382x.c +++ b/drivers/net/ns8382x.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-7-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/ns8382x.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

pcnet driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/pcnet.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index 99b6942..e994cb6 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-8-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/pcnet.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

tsi108_eth driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/tsi108_eth.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 079354a..f100ec1 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c @@ -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);

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-9-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/tsi108_eth.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

uli526x driver does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com --- drivers/net/uli526x.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c index 56eee7b..fca5c09 100644 --- a/drivers/net/uli526x.c +++ b/drivers/net/uli526x.c @@ -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));

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-10-git-send-email-iwamatsu@nigauri.org 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.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/uli526x.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Hi, Ben and Wolfgang.
Could you take in these patches?
Best regards, Nobuhiro
2010/10/19 Nobuhiro Iwamatsu iwamatsu@nigauri.org:
rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/rtl8169.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index e45d1a5..d6bc514 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -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

Dear Nobuhiro Iwamatsu,
In message AANLkTinTt5pD40-Z+rvyWyf303nG9cMTE6wpAo_R2i+3@mail.gmail.com you wrote:
Could you take in these patches?
Are these bug fixes, or can they wait for the "next" branch?
Best regards,
Wolfgang Denk

Hi, Wolfgang.
2010/10/28 Wolfgang Denk wd@denx.de:
Dear Nobuhiro Iwamatsu,
In message AANLkTinTt5pD40-Z+rvyWyf303nG9cMTE6wpAo_R2i+3@mail.gmail.com you wrote:
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

Dear Nobuhiro Iwamatsu,
In message 1287464627-12302-1-git-send-email-iwamatsu@nigauri.org you wrote:
rtl8169 does not have write_hwaddr function. However, eth stuff executes write_hwaddr function because eth_device structure has not been initialized.
Signed-off-by: Nobuhiro Iwamatsu iwamatsu@nigauri.org CC: Ben Warren biggerbadderben@gmail.com
drivers/net/rtl8169.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Nobuhiro Iwamatsu
-
Wolfgang Denk