diff options
| author | Tom Rini <trini@ti.com> | 2012-09-27 12:06:07 -0700 |
|---|---|---|
| committer | Tom Rini <trini@ti.com> | 2012-09-27 12:06:07 -0700 |
| commit | cec2655c3b3b86f14a6a5c2cbb01833f7e3974be (patch) | |
| tree | 8428f50b579b3656fd24056ae3c6304f58aee620 /net/eth.c | |
| parent | c57b953da923c6402afc1c890c21fdc7d5a2cc4a (diff) | |
| parent | ee0f60df0b71092cd632fc6651f4157a2d252598 (diff) | |
| download | olio-uboot-2014.01-cec2655c3b3b86f14a6a5c2cbb01833f7e3974be.tar.xz olio-uboot-2014.01-cec2655c3b3b86f14a6a5c2cbb01833f7e3974be.zip | |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'net/eth.c')
| -rw-r--r-- | net/eth.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -121,12 +121,8 @@ static struct { static unsigned int eth_rcv_current, eth_rcv_last; #endif -static struct eth_device *eth_devices, *eth_current; - -struct eth_device *eth_get_dev(void) -{ - return eth_current; -} +static struct eth_device *eth_devices; +struct eth_device *eth_current; struct eth_device *eth_get_dev_by_name(const char *devname) { @@ -222,9 +218,12 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name, } if (dev->write_hwaddr && - !eth_mac_skip(eth_number) && - is_valid_ether_addr(dev->enetaddr)) + !eth_mac_skip(eth_number)) { + if (!is_valid_ether_addr(dev->enetaddr)) + return -1; + ret = dev->write_hwaddr(dev); + } return ret; } @@ -500,10 +499,7 @@ int eth_receive(void *packet, int length) return -1; } - if (length < eth_rcv_bufs[eth_rcv_current].length) - return -1; - - length = eth_rcv_bufs[eth_rcv_current].length; + length = min(eth_rcv_bufs[eth_rcv_current].length, length); for (i = 0; i < length; i++) p[i] = eth_rcv_bufs[eth_rcv_current].data[i]; |