diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2018-09-17 22:21:16 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-19 09:55:54 +0200 |
commit | 7d10ce746400be92ce569a3d3035346d5f0e1619 (patch) | |
tree | bf654690f28e69b40bf42e173736d0482e52cebe /drivers | |
parent | e6b0633b51f9cacb0f0e649e44a56dce50883d8d (diff) | |
download | barebox-7d10ce746400be92ce569a3d3035346d5f0e1619.tar.gz barebox-7d10ce746400be92ce569a3d3035346d5f0e1619.tar.xz |
net: fec_imx: Drop extra indentation level by exiting early
Drop extra indentation level by exiting early which also allows us to
check for bd_status & FEC_RBD_EMPTY instead of !(bd_status &
FEC_RBD_EMPTY).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fec_imx.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 94a159e2b1..904eba30a0 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -568,35 +568,36 @@ static int fec_recv(struct eth_device *dev) */ bd_status = readw(&rbd->status); - if (!(bd_status & FEC_RBD_EMPTY)) { - if ((bd_status & FEC_RBD_LAST) && !(bd_status & FEC_RBD_ERR) && - ((readw(&rbd->data_length) - 4) > 14)) { - - if (fec_is_imx28(fec)) - imx28_fix_endianess_rd( - phys_to_virt(readl(&rbd->data_pointer)), - (readw(&rbd->data_length) + 3) >> 2); - - /* - * Get buffer address and size - */ - frame = phys_to_virt(readl(&rbd->data_pointer)); - 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); - } - } + 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 (fec_is_imx28(fec)) + imx28_fix_endianess_rd( + phys_to_virt(readl(&rbd->data_pointer)), + (readw(&rbd->data_length) + 3) >> 2); + /* - * free the current buffer, restart the engine - * and move forward to the next buffer + * Get buffer address and size */ - fec_rbd_clean(fec->rbd_index == (FEC_RBD_NUM - 1) ? 1 : 0, rbd); - fec_rx_task_enable(fec); - fec->rbd_index = (fec->rbd_index + 1) % FEC_RBD_NUM; + frame = phys_to_virt(readl(&rbd->data_pointer)); + 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 + * and move forward to the next buffer + */ + fec_rbd_clean(fec->rbd_index == (FEC_RBD_NUM - 1) ? 1 : 0, rbd); + fec_rx_task_enable(fec); + fec->rbd_index = (fec->rbd_index + 1) % FEC_RBD_NUM; return len; } |