]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: eepro100: Add initialized eth_device structure
authorNobuhiro Iwamatsu <iwamatsu@nigauri.org>
Tue, 19 Oct 2010 05:03:41 +0000 (14:03 +0900)
committerWolfgang Denk <wd@denx.de>
Sun, 14 Nov 2010 22:17:41 +0000 (23:17 +0100)
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

index 22e14e3814deeadf854b0b09d4494d4038c5b360..ae0e0d458209c4406fee32a3a0e50b29a57171e2 100644 (file)
@@ -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() */