X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Fpcnet.c;h=c028a44a9ecab332d46353ffe27746116da37f50;hb=a6187dccd813920524987792e49ef2feffb213e6;hp=aa04e8f185976e0f3248171f227d887ac0e23a3e;hpb=f2c288a35341ad02ac03b1563d786763c9c8f159;p=u-boot diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c index aa04e8f185..c028a44a9e 100644 --- a/drivers/net/pcnet.c +++ b/drivers/net/pcnet.c @@ -26,27 +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 -#if defined(CONFIG_CMD_NET) \ - && defined(CONFIG_NET_MULTI) && defined(CONFIG_PCNET) +#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!" @@ -152,8 +141,7 @@ static int pcnet_check (struct eth_device *dev) } static int pcnet_init (struct eth_device *dev, bd_t * bis); -static int pcnet_send (struct eth_device *dev, volatile void *packet, - int length); +static int pcnet_send(struct eth_device *dev, void *packet, int length); static int pcnet_recv (struct eth_device *dev); static void pcnet_halt (struct eth_device *dev); static int pcnet_probe (struct eth_device *dev, bd_t * bis, int dev_num); @@ -189,6 +177,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); @@ -421,8 +414,7 @@ static int pcnet_init (struct eth_device *dev, bd_t * bis) return 0; } -static int pcnet_send (struct eth_device *dev, volatile void *packet, - int pkt_len) +static int pcnet_send(struct eth_device *dev, void *packet, int pkt_len) { int i, status; struct pcnet_tx_head *entry = &lp->tx_ring[lp->cur_tx]; @@ -537,4 +529,3 @@ static void pcnet_halt (struct eth_device *dev) printf ("%s: TIMEOUT: controller reset failed\n", dev->name); } } -#endif