]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - cpu/mips/au1x00_eth.c
au1x00_eth.c: check malloc return value and abort if it failed
[karo-tx-uboot.git] / cpu / mips / au1x00_eth.c
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;