X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Feepro100.c;h=07ec34cbba4b9a560ae73d9d65427213d9f26e87;hb=65029492914ea96dec0bfe25a987463a869c72d2;hp=5cb767a795fa0ac132ca8ea770d33a0205877309;hpb=5700bb63522c2af9276f25a15448b61f19d72841;p=u-boot diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 5cb767a795..07ec34cbba 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; @@ -334,7 +335,7 @@ static struct eth_device* verify_phyaddr (char *devname, unsigned char addr) } /* read id2 register */ - if (get_phyreg(dev, addr, PHY_PHYIDR2, &value) != 0) { + if (get_phyreg(dev, addr, MII_PHYSID2, &value) != 0) { printf("%s: mii read timeout!\n", devname); return NULL; } @@ -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() */ @@ -917,7 +923,6 @@ static void purge_tx_ring (struct eth_device *dev) static void read_hw_addr (struct eth_device *dev, bd_t * bis) { - u16 eeprom[0x40]; u16 sum = 0; int i, j; int addr_len = read_eeprom (dev, 0, 6) == 0xffff ? 8 : 6; @@ -925,7 +930,6 @@ static void read_hw_addr (struct eth_device *dev, bd_t * bis) for (j = 0, i = 0; i < 0x40; i++) { u16 value = read_eeprom (dev, i, addr_len); - eeprom[i] = value; sum += value; if (i < 3) { dev->enetaddr[j++] = value;