]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/rtl8139.c
Merge branch 'master' of git://git.denx.de/u-boot-samsung
[karo-tx-uboot.git] / drivers / net / rtl8139.c
index 097f6841aeeeaa6d018ed737f55a7f7d9283a5f8..c2779db0a5c20cadd55265e163feb671ce8445c6 100644 (file)
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \
-       defined(CONFIG_RTL8139)
-
 #define RTL_TIMEOUT    100000
 
 #define ETH_FRAME_LEN          1514
@@ -222,6 +220,11 @@ int rtl8139_initialize(bd_t *bis)
                debug ("rtl8139: REALTEK RTL8139 @0x%x\n", iobase);
 
                dev = (struct eth_device *)malloc(sizeof *dev);
+               if (!dev) {
+                       printf("Can not allocate memory of rtl8139\n");
+                       break;
+               }
+               memset(dev, 0, sizeof(*dev));
 
                sprintf (dev->name, "RTL8139#%d", card_number);
 
@@ -289,7 +292,7 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
 
 /*
        Delay between EEPROM clock transitions.
-       No extra delay is needed with 33Mhz PCI, but 66Mhz may change this.
+       No extra delay is needed with 33MHz PCI, but 66MHz may change this.
 */
 
 #define eeprom_delay() inl(ee_addr)
@@ -545,4 +548,3 @@ static void rtl_disable(struct eth_device *dev)
                udelay (100); /* wait 100us */
        }
 }
-#endif