]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
au1x00_eth.c: check malloc return value and abort if it failed
authorWolfgang Denk <wd@pollux.denx.de>
Mon, 13 Mar 2006 00:00:22 +0000 (01:00 +0100)
committerWolfgang Denk <wd@pollux.denx.de>
Mon, 13 Mar 2006 00:00:22 +0000 (01:00 +0100)
Patch by Andrew Dyer, 26 Jul 2005

CHANGELOG
cpu/mips/au1x00_eth.c

index 889cfd5e9e1ec59761f53a3b4413750a2fc45239..8ce3a1bfc4b03a16c2217bb35ed1c0d29e51cc15 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
 Changes since U-Boot 1.1.4:
 ======================================================================
 
+* au1x00_eth.c: check malloc return value and abort if it failed
+  Patch by Andrew Dyer, 26 Jul 2005
+
 * Change the sequence of events in soft_i2c.c:send_ack() to keep from
   incorrectly generating start/stop conditions on the bus.
   Patch by Andrew Dyer, 26 Jul 2005
index 9ce9b353978b8c9d26fcc9e2973e166c1135ee85..078e8328b625d4262632f3a2c9803775dfc7dffe 100644 (file)
@@ -224,10 +224,14 @@ static void au1x00_halt(struct eth_device* dev){
 int au1x00_enet_initialize(bd_t *bis){
        struct eth_device* dev;
 
-       dev = (struct eth_device*) malloc(sizeof *dev);
+       if ((dev = (struct eth_device*)malloc(sizeof *dev)) == NULL) {
+               puts ("malloc failed\n");
+               return 0;
+       }
+
        memset(dev, 0, sizeof *dev);
 
-       sprintf(dev->name, "Au1X00 ETHERNET");
+       sprintf(dev->name, "Au1X00 ethernet");
        dev->iobase = 0;
        dev->priv   = 0;
        dev->init   = au1x00_init;