Patchwork [3/3] e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers

login
register
mail settings
Submitter Christoph Paasch
Date March 16, 2013, 10:32 a.m.
Message ID <1363429925-12724-4-git-send-email-christoph.paasch@uclouvain.be>
Download mbox | patch
Permalink /patch/228206/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Christoph Paasch - March 16, 2013, 10:32 a.m.
After dma_map_page, dma_mapping_error must be called. It seems safe to
not free the skb/page allocated in this function, as the skb/page can be
reused later.

Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Jeff Kirsher - March 20, 2013, 12:47 a.m.
On Sat, 2013-03-16 at 11:32 +0100, Christoph Paasch wrote:
> After dma_map_page, dma_mapping_error must be called. It seems safe to
> not free the skb/page allocated in this function, as the skb/page can
> be
> reused later.
> 
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> ---
>  drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-) 

Added to my e1000e patch queue

Patch

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 142ca39..5706dcd 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -846,11 +846,16 @@  check_page:
 			}
 		}
 
-		if (!buffer_info->dma)
+		if (!buffer_info->dma) {
 			buffer_info->dma = dma_map_page(&pdev->dev,
 							buffer_info->page, 0,
 							PAGE_SIZE,
 							DMA_FROM_DEVICE);
+			if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+				adapter->alloc_rx_buff_failed++;
+				break;
+			}
+		}
 
 		rx_desc = E1000_RX_DESC_EXT(*rx_ring, i);
 		rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);