X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fpcnet.c;h=45066c8feafd272ba2b07d81bb5f4ff0735f2d91;hb=a939ea3ab459d5fb3d1eaaec289c6ca85f2f74c1;hp=a4f02141063621588bd4ca837b5e7e36563091c6;hpb=3b904ccb93c3196727e2e9870cb1df903cab19ad;p=oweals%2Fu-boot.git diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index a4f0214106..45066c8fea 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -26,24 +26,16 @@ #include #include #include +#include #include #include -#if 0 #define PCNET_DEBUG_LEVEL 0 /* 0=off, 1=init, 2=rx/tx */ -#endif -#if PCNET_DEBUG_LEVEL > 0 -#define PCNET_DEBUG1(fmt,args...) printf (fmt ,##args) -#if PCNET_DEBUG_LEVEL > 1 -#define PCNET_DEBUG2(fmt,args...) printf (fmt ,##args) -#else -#define PCNET_DEBUG2(fmt,args...) -#endif -#else -#define PCNET_DEBUG1(fmt,args...) -#define PCNET_DEBUG2(fmt,args...) -#endif +#define PCNET_DEBUG1(fmt,args...) \ + debug_cond(PCNET_DEBUG_LEVEL > 0, fmt ,##args) +#define PCNET_DEBUG2(fmt,args...) \ + debug_cond(PCNET_DEBUG_LEVEL > 1, fmt ,##args) #if !defined(CONF_PCNET_79C973) && defined(CONF_PCNET_79C975) #error "Macro for PCnet chip version is not defined!" @@ -186,6 +178,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);