net: dm9000: Correctly handle empty FIFO
PATCH 1/1 net: dm9000: Correctly handle empty FIFO
Assign packet pointer only in case the MAC reports anything in the FIFO. In case the MAC indicates empty FIFO, return 0 to pass that information to the network stack.
Signed-off-by Marek Vasut <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Ramon Fried <[email protected]>
--- drivers/net/dm9000x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dm9000x.c +2 -2
@@ -666,10 +666,10 @@ static int dm9000_recv(struct udevice *dev, int flags, uchar **packetp)int ret; ret =dm9000_recv_common (db, data); -if (ret) +if (ret >0 ) *packetp = (void *)data; -return ret ? ret : -EAGAIN ; +return ret >=0 ? ret : -EAGAIN ; }static int dm9000_write_hwaddr (struct udevice *dev)
Signature · 1 line
2.35.1
Quoted 30 lines · Marek Vasut
Assign packet pointer only in case the MAC reports anything in the FIFO. In case the MAC indicates empty FIFO, return 0 to pass that information to the network stack.
Signed-off-by Marek Vasut <[email protected]>Cc Joe Hershberger <[email protected]>Cc Ramon Fried <[email protected]>--- drivers/net/dm9000x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/dm9000x.c +2
-3@@ -666,10 +666,10 @@ static int dm9000_recv(struct udevice *dev, int flags, uchar **packetp)int ret; ret =dm9000_recv_common (db, data); -if (ret) +if (ret >0 ) *packetp = (void *)data; -return ret ? ret : -EAGAIN ; +return ret >=0 ? ret : -EAGAIN ; }static int dm9000_write_hwaddr (struct udevice *dev) --
Quoted 2 lines
2.35.1
Reviewed-by Ramon Fried <[email protected]>
Quoted 8 lines · Marek Vasut
Assign packet pointer only in case the MAC reports anything in the FIFO. In case the MAC indicates empty FIFO, return 0 to pass that information to the network stack.
Signed-off-by Marek Vasut <[email protected]>Cc Joe Hershberger <[email protected]>Cc Ramon Fried <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom