]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/net/pcnet.c
Merge branch 'master' of git://git.denx.de/u-boot-samsung
[karo-tx-uboot.git] / drivers / net / pcnet.c
index aa04e8f185976e0f3248171f227d887ac0e23a3e..e994cb690197f722f50ef03f6fd2c8c2035e11f0 100644 (file)
@@ -26,6 +26,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
 
@@ -45,9 +46,6 @@
 #define PCNET_DEBUG2(fmt,args...)
 #endif
 
-#if defined(CONFIG_CMD_NET) \
-       && defined(CONFIG_NET_MULTI) && defined(CONFIG_PCNET)
-
 #if !defined(CONF_PCNET_79C973) && defined(CONF_PCNET_79C975)
 #error "Macro for PCnet chip version is not defined!"
 #endif
@@ -189,6 +187,11 @@ int pcnet_initialize (bd_t * bis)
                 * Allocate and pre-fill the device structure.
                 */
                dev = (struct eth_device *) malloc (sizeof *dev);
+               if (!dev) {
+                       printf("pcnet: Can not allocate memory\n");
+                       break;
+               }
+               memset(dev, 0, sizeof(*dev));
                dev->priv = (void *) devbusfn;
                sprintf (dev->name, "pcnet#%d", dev_nr);
 
@@ -537,4 +540,3 @@ static void pcnet_halt (struct eth_device *dev)
                printf ("%s: TIMEOUT: controller reset failed\n", dev->name);
        }
 }
-#endif