Patchwork [2/3] ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers

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

Comments

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

Additionally this patch fixes one coding-style error.

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

Added to my ixgb patch queue

Patch

diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
index e23f023..6662c7c 100644
--- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c
+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c
@@ -2155,6 +2155,10 @@  map_skb:
 		                                  skb->data,
 		                                  adapter->rx_buffer_len,
 						  DMA_FROM_DEVICE);
+		if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+			adapter->alloc_rx_buff_failed++;
+			break;
+		}
 
 		rx_desc = IXGB_RX_DESC(*rx_ring, i);
 		rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
@@ -2164,7 +2168,8 @@  map_skb:
 		rx_desc->status = 0;
 
 
-		if (++i == rx_ring->count) i = 0;
+		if (++i == rx_ring->count)
+			i = 0;
 		buffer_info = &rx_ring->buffer_info[i];
 	}