X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Feepro100.c;h=ae0e0d458209c4406fee32a3a0e50b29a57171e2;hb=b9d77535e9335b554af03aa0e0a54b664677d018;hp=9c06b25569419d73d96b4537e7db3b4339967032;hpb=f61f1e150c84f5b9347fca79a4bc5f2286c545d2;p=u-boot diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 9c06b25569..ae0e0d4582 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -321,7 +321,8 @@ static int set_phyreg (struct eth_device *dev, unsigned char addr, /* Check if given phyaddr is valid, i.e. there is a PHY connected. * Do this by checking model value field from ID2 register. */ -static struct eth_device* verify_phyaddr (char *devname, unsigned char addr) +static struct eth_device* verify_phyaddr (const char *devname, + unsigned char addr) { struct eth_device *dev; unsigned short value; @@ -350,7 +351,7 @@ static struct eth_device* verify_phyaddr (char *devname, unsigned char addr) return dev; } -static int eepro100_miiphy_read (char *devname, unsigned char addr, +static int eepro100_miiphy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value) { struct eth_device *dev; @@ -367,7 +368,7 @@ static int eepro100_miiphy_read (char *devname, unsigned char addr, return 0; } -static int eepro100_miiphy_write (char *devname, unsigned char addr, +static int eepro100_miiphy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value) { struct eth_device *dev; @@ -449,6 +450,11 @@ int eepro100_initialize (bd_t * bis) } dev = (struct eth_device *) malloc (sizeof *dev); + if (!dev) { + printf("eepro100: Can not allocate memory\n"); + break; + } + memset(dev, 0, sizeof(*dev)); sprintf (dev->name, "i82559#%d", card_number); dev->priv = (void *) devno; /* this have to come before bus_to_phys() */