summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-09-17 22:21:17 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-09-19 09:55:54 +0200
commitfb12695461738359430486f2694180fdad46c37c (patch)
tree1bd635127190cb7b7f0b615593930c63e0a00814
parent7d10ce746400be92ce569a3d3035346d5f0e1619 (diff)
downloadbarebox-fb12695461738359430486f2694180fdad46c37c.tar.gz
barebox-fb12695461738359430486f2694180fdad46c37c.tar.xz
net: fec_imx: Don't check bd_status & FEC_RBD_ERR twice
Re-shuffle comparisons in order to avoid having to check for FEC_RBD_ERR in bd_status more than once. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/net/fec_imx.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 904eba30a0..25e2425d6e 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -571,9 +571,11 @@ static int fec_recv(struct eth_device *dev)
if (bd_status & FEC_RBD_EMPTY)
return 0;
- if ((bd_status & FEC_RBD_LAST) && !(bd_status & FEC_RBD_ERR) &&
- ((readw(&rbd->data_length) - 4) > 14)) {
-
+ if (bd_status & FEC_RBD_ERR) {
+ dev_warn(&dev->dev, "error frame: 0x%p 0x%08x\n",
+ rbd, bd_status);
+ } else if ((bd_status & FEC_RBD_LAST) &&
+ ((readw(&rbd->data_length) - 4) > 14)) {
if (fec_is_imx28(fec))
imx28_fix_endianess_rd(
phys_to_virt(readl(&rbd->data_pointer)),
@@ -586,10 +588,6 @@ static int fec_recv(struct eth_device *dev)
frame_length = readw(&rbd->data_length) - 4;
net_receive(dev, frame->data, frame_length);
len = frame_length;
- } else {
- if (bd_status & FEC_RBD_ERR) {
- dev_warn(&dev->dev, "error frame: 0x%p 0x%08x\n", rbd, bd_status);
- }
}
/*
* free the current buffer, restart the engine