Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1416518 > unrolled thread

[PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-06-07 21:20 +0200
Last post2016-06-08 05:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-06-07 21:20 +0200
    Re: [PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc Vinod Koul <vinod.koul@intel.com> - 2016-06-08 05:30 +0200

#1416518 — [PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-06-07 21:20 +0200
Subject[PATCH] dmaengine: xilinx_vdma: Use dma_pool_zalloc
Message-ID<rHuHE-6FD-7@gated-at.bofh.it>
Dma_pool_zalloc combines dma_pool_alloc and memset 0.

The Coccinelle semantic patch used to make this change is as follows:
@@
type T;
T *d;
expression e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(T));

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/dma/xilinx/xilinx_vdma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c
index ef67f27..d35317f 100644
--- a/drivers/dma/xilinx/xilinx_vdma.c
+++ b/drivers/dma/xilinx/xilinx_vdma.c
@@ -315,11 +315,10 @@ xilinx_vdma_alloc_tx_segment(struct xilinx_vdma_chan *chan)
 	struct xilinx_vdma_tx_segment *segment;
 	dma_addr_t phys;
 
-	segment = dma_pool_alloc(chan->desc_pool, GFP_ATOMIC, &phys);
+	segment = dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &phys);
 	if (!segment)
 		return NULL;
 
-	memset(segment, 0, sizeof(*segment));
 	segment->phys = phys;
 
 	return segment;
-- 
1.9.1

[toc] | [next] | [standalone]


#1416847

FromVinod Koul <vinod.koul@intel.com>
Date2016-06-08 05:30 +0200
Message-ID<rHClP-336-1@gated-at.bofh.it>
In reply to#1416518
On Wed, Jun 08, 2016 at 12:48:38AM +0530, Amitoj Kaur Chawla wrote:
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.
> 
> The Coccinelle semantic patch used to make this change is as follows:
> @@
> type T;
> T *d;
> expression e;
> statement S;
> @@
> 
>         d =
> -            dma_pool_alloc
> +            dma_pool_zalloc
>              (...);
>         if (!d) S
> -       memset(d, 0, sizeof(T));

Thanks for your patch, but I have already applied a similar patch fixing
this.

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web