Merge with git://www.denx.de/git/u-boot.git
[oweals/u-boot.git] / cpu / mips / au1x00_eth.c
index 9ce9b353978b8c9d26fcc9e2973e166c1135ee85..b69741ae6833f9b40fabf06e26d56b54ee272497 100644 (file)
@@ -63,7 +63,7 @@
 #include <asm/io.h>
 #include <asm/au1x00.h>
 
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_CMD_MII)
 #include <miiphy.h>
 #endif
 
@@ -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;
@@ -237,7 +241,7 @@ int au1x00_enet_initialize(bd_t *bis){
 
        eth_register(dev);
 
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_CMD_MII)
        miiphy_register(dev->name,
                au1x00_miiphy_read, au1x00_miiphy_write);
 #endif
@@ -245,7 +249,7 @@ int au1x00_enet_initialize(bd_t *bis){
        return 1;
 }
 
-#if (CONFIG_COMMANDS & CFG_CMD_MII)
+#if defined(CONFIG_CMD_MII)
 int  au1x00_miiphy_read(char *devname, unsigned char addr,
                unsigned char reg, unsigned short * value)
 {
@@ -302,6 +306,6 @@ int  au1x00_miiphy_write(char *devname, unsigned char addr,
        *mii_control_reg = mii_control;
        return 0;
 }
-#endif /* CONFIG_COMMANDS & CFG_CMD_MII */
+#endif
 
 #endif /* CONFIG_AU1X00 */