Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

2 messages, 2 authors, 2017-01-24 · open the first message on its own page

Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

From: Valo, Kalle <hidden>
Date: 2017-01-24 05:18:56

Joe Perches [off-list ref] writes:
On Mon, 2017-01-23 at 15:04 +0000, Srinivas Kandagatla wrote:
quoted
use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().
[]
quoted
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
[]
quoted
@@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
 	 */
 	alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
 
-	data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
+	data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
 						       alloc_nbytes,
 						       &ce_data_base,
 						       GFP_ATOMIC);
trivia:

Nicer to realign arguments and remove the unnecessary cast.

Perhaps:

	data_buf = dma_zalloc_coherent(ar->dev, alloc_nbytes, &ce_data_base,
				       GFP_ATOMIC);
Sure, but that should be in a separate patch.

-- 
Kalle Valo

Re: [PATCH 2/3] ath10k: use dma_zalloc_coherent()

From: Joe Perches <joe@perches.com>
Date: 2017-01-24 05:25:35

On Tue, 2017-01-24 at 05:18 +0000, Valo, Kalle wrote:
Joe Perches [off-list ref] writes:
quoted
On Mon, 2017-01-23 at 15:04 +0000, Srinivas Kandagatla wrote:
quoted
use dma_zalloc_coherent() instead of dma_alloc_coherent and memset().
[]
quoted
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
[]
quoted
@@ -896,7 +896,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
 	 */
 	alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
 
-	data_buf = (unsigned char *)dma_alloc_coherent(ar->dev,
+	data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
 						       alloc_nbytes,
 						       &ce_data_base,
 						       GFP_ATOMIC);
trivia:

Nicer to realign arguments and remove the unnecessary cast.

Perhaps:

	data_buf = dma_zalloc_coherent(ar->dev, alloc_nbytes, &ce_data_base,
				       GFP_ATOMIC);
Sure, but that should be in a separate patch.
I don't think so, trivial patches can be combined.

It's also nicer to realign all modified multiline
arguments when performing these changes.

Coccinelle generally does it automatically.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help