Skip to contentSkip to conversation

ethernet: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset

PATCH New zhong jiang 2 participants 3 messages Aug 18, 2018 – Aug 20, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethernet: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset

dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset (), We prefer to dma_zalloc_coherent instead of open-codeing.

---
 drivers/net/ethernet/intel/ixgb/ixgb_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 -3
index 43664ad..d3e72d0 100644
@@ -771,14 +771,13 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
 	rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
 	rxdr->size = ALIGN(rxdr->size, 4096);
 
-	rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-					GFP_KERNEL);
+	rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+					 GFP_KERNEL);
 
 	if (!rxdr->desc) {
 		vfree(rxdr->buffer_info);
 		return -ENOMEM;
 	}
-	memset(rxdr->desc, 0, rxdr->size);
 
 	rxdr->next_to_clean = 0;
 	rxdr->next_to_use = 0;
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/1 ethernet: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset

Please send ALL patches against drivers I maintain to the Intel-wired-lan at lists.osuosl.org. Your repeated refusal to do so, makes me think you are trying to circumvent the maintainer (me) and the correct kernel patch process.

Sent from my iPhone

Quoted 34 lines · zhong jiang

dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset (), We prefer to dma_zalloc_coherent instead of open-codeing.

---
drivers/net/ethernet/intel/ixgb/ixgb_main.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 -3
index 43664ad..d3e72d0 100644
@@ -771,14 +771,13 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
   rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
   rxdr->size = ALIGN(rxdr->size, 4096);
 
-    rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-                    GFP_KERNEL);
+    rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+                     GFP_KERNEL);
 
   if (!rxdr->desc) {
       vfree(rxdr->buffer_info);
       return -ENOMEM;
   }
-    memset(rxdr->desc, 0, rxdr->size);
 
   rxdr->next_to_clean = 0;
   rxdr->next_to_use = 0;
Signature · 1 line
1.7.12.4
#2 lore raw

PATCH 1/1 ethernet: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset

Quoted 1 line · Jeffrey T

Please send ALL patches against drivers I maintain to the Intel-wired-lan at lists.osuosl.org. Your repeated refusal to do so, makes me think you are trying to circumvent the maintainer (me) and the correct kernel patch process.

I am sorry to that. :-[ It is my fault that I never want to circumvent the maintainer. I will notice that for next time. Thank you for your understanding.

Best wishes,
zhong jiang

Quoted 38 lines

Sent from my iPhone

Quoted 34 lines · zhong jiang

dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset (), We prefer to dma_zalloc_coherent instead of open-codeing.

---
drivers/net/ethernet/intel/ixgb/ixgb_main.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgb/ixgb_main.c +2 -3
index 43664ad..d3e72d0 100644
@@ -771,14 +771,13 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
   rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
   rxdr->size = ALIGN(rxdr->size, 4096);
 
-    rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-                    GFP_KERNEL);
+    rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+                     GFP_KERNEL);
 
   if (!rxdr->desc) {
       vfree(rxdr->buffer_info);
       return -ENOMEM;
   }
-    memset(rxdr->desc, 0, rxdr->size);
 
   rxdr->next_to_clean = 0;
   rxdr->next_to_use = 0;
Signature · 1 line
1.7.12.4

.