X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fnet%2Frtl8139.c;h=c2779db0a5c20cadd55265e163feb671ce8445c6;hb=be44f75887f27400e3abcf69886c8a3663f23bac;hp=014f3b4324b21b548d2fa32a875b680acbf0babe;hpb=96a236746fe6a7b84802afb4ed31536696d34812;p=u-boot diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index 014f3b4324..c2779db0a5 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -74,12 +74,10 @@ #include #include #include +#include #include #include -#if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI) && \ - defined(CONFIG_RTL8139) - #define RTL_TIMEOUT 100000 #define ETH_FRAME_LEN 1514 @@ -222,6 +220,11 @@ int rtl8139_initialize(bd_t *bis) debug ("rtl8139: REALTEK RTL8139 @0x%x\n", iobase); dev = (struct eth_device *)malloc(sizeof *dev); + if (!dev) { + printf("Can not allocate memory of rtl8139\n"); + break; + } + memset(dev, 0, sizeof(*dev)); sprintf (dev->name, "RTL8139#%d", card_number); @@ -289,7 +292,7 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis) /* Delay between EEPROM clock transitions. - No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. + No extra delay is needed with 33MHz PCI, but 66MHz may change this. */ #define eeprom_delay() inl(ee_addr) @@ -489,7 +492,7 @@ static int rtl_poll(struct eth_device *dev) ring_offs = cur_rx % RX_BUF_LEN; /* ring_offs is guaranteed being 4-byte aligned */ - rx_status = *(unsigned int *)(rx_ring + ring_offs); + rx_status = le32_to_cpu(*(unsigned int *)(rx_ring + ring_offs)); rx_size = rx_status >> 16; rx_status &= 0xffff; @@ -545,4 +548,3 @@ static void rtl_disable(struct eth_device *dev) udelay (100); /* wait 100us */ } } -#endif