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

index e09da1d2ae429108973cb61c06d9cb161a7800ca..14b2d355c15e07d5336445808bc79321e276f6c5 100644 (file)
@@ -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);