diff options
author | Marek Vasut | 2022-04-25 20:28:05 +0200 |
---|---|---|
committer | Tom Rini | 2022-08-08 10:50:20 -0400 |
commit | ecd8b0371386eb0b1826f5d067a3086ad5184a85 (patch) | |
tree | f7a91213acb26a7aa65cf99141ec84f596e1f4f3 | |
parent | 01207947d54e4d8a356a19658640213be4939f62 (diff) |
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 <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
-rw-r--r-- | drivers/net/dm9000x.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index 78ce536d4a3..07733df533e 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -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) |