[PATCH 06/16] net/e1000: Fix incorrect "Rx ready" check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to wrong placement of parenthesis in

	if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
		return 0;

instead of checking that E1000_RXD_STAT_DD is not set, the condition
ends up checking that "status" is 0.

Change the code to invert the condition tested and get rid of !
entirely.

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 drivers/net/e1000/main.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/e1000/main.c b/drivers/net/e1000/main.c
index 5ab4eb3fd..e793785e6 100644
--- a/drivers/net/e1000/main.c
+++ b/drivers/net/e1000/main.c
@@ -3396,18 +3396,21 @@ static int e1000_poll(struct eth_device *edev)
 
 	rd = hw->rx_base + hw->rx_last;
 
-	if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
-		return 0;
+	if (le32_to_cpu(rd->status) & E1000_RXD_STAT_DD) {
+		len = le32_to_cpu(rd->length);
 
-	len = le32_to_cpu(rd->length);
+		dma_sync_single_for_cpu(hw->packet_dma, len,
+					DMA_FROM_DEVICE);
 
-	dma_sync_single_for_cpu(hw->packet_dma, len, DMA_FROM_DEVICE);
+		net_receive(edev, hw->packet, len);
 
-	net_receive(edev, hw->packet, len);
+		dma_sync_single_for_device(hw->packet_dma, len,
+					   DMA_FROM_DEVICE);
+		fill_rx(hw);
+		return 1;
+	}
 
-	dma_sync_single_for_device(hw->packet_dma, len, DMA_FROM_DEVICE);
-	fill_rx(hw);
-	return 1;
+	return 0;
 }
 
 static int e1000_transmit(struct eth_device *edev, void *txpacket, int length)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux