From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>
Subject: [PATCH] net: dm9000: Correctly handle empty FIFO
Date: Mon, 25 Apr 2022 20:28:05 +0200 [thread overview]
Message-ID: <20220425182805.247389-1-marex@denx.de> (raw)
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>
---
drivers/net/dm9000x.c | 4 ++--
1 file 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)
--
2.35.1
next reply other threads:[~2022-04-25 18:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 18:28 Marek Vasut [this message]
2022-04-30 23:33 ` [PATCH] net: dm9000: Correctly handle empty FIFO Ramon Fried
2022-08-08 19:07 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220425182805.247389-1-marex@denx.de \
--to=marex@denx.de \
--cc=joe.hershberger@ni.com \
--cc=rfried.dev@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.