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

index 198f73dee695074486704523f365d5f4906212f7..45402cc0ec3d7ed8ed79f1c88d058ff22ebfe49a 100644 (file)
@@ -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);