aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/eth
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-04-05 16:23:28 -0600
committerTom Rini <trini@konsulko.com>2017-05-09 20:17:24 -0400
commit20b429b013c97cb3d253274003d52bbe8c9c4da1 (patch)
treefdac265d99d9b6b2b552b252039f7f9b17798978 /drivers/usb/eth
parentdd9999d5f4d3a0354c959fa3bccc0957a1164bf5 (diff)
downloadu-boot-20b429b013c97cb3d253274003d52bbe8c9c4da1.zip
u-boot-20b429b013c97cb3d253274003d52bbe8c9c4da1.tar.gz
u-boot-20b429b013c97cb3d253274003d52bbe8c9c4da1.tar.bz2
net: smsc95xx: Correct free_pkt() implementation
On further review this returns the wrong packet length from the driver. It may not be noticed since protocols will take care of it. Fix it by subtracting the header length from the packet length returned. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/usb/eth')
-rw-r--r--drivers/usb/eth/smsc95xx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index d4c8ea4..26000a5 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -998,7 +998,7 @@ int smsc95xx_eth_recv(struct udevice *dev, int flags, uchar **packetp)
}
*packetp = ptr + sizeof(packet_len);
- return packet_len;
+ return packet_len - 4;
err:
usb_ether_advance_rxbuf(ueth, -1);
@@ -1009,7 +1009,7 @@ static int smsc95xx_free_pkt(struct udevice *dev, uchar *packet, int packet_len)
{
struct smsc95xx_private *priv = dev_get_priv(dev);
- packet_len = ALIGN(packet_len, 4);
+ packet_len = ALIGN(packet_len + sizeof(u32), 4);
usb_ether_advance_rxbuf(&priv->ueth, sizeof(u32) + packet_len);
return 0;