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

index 5ae53e816b1b0d9629105e94fd599d60f26bf999..51e7c19e03d418d26f9e6d5c9d6d2dc106b04b00 100644 (file)
@@ -280,6 +280,12 @@ int dc21x4x_initialize(bd_t *bis)
 
                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);
 #else