linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Use dma_pool_zalloc
@ 2016-04-29 20:09 Julia Lawall
  2016-04-29 20:09 ` [PATCH 4/5] crypto: " Julia Lawall
  2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2016-04-29 20:09 UTC (permalink / raw)
  To: linux-crypto
  Cc: kernel-janitors, linux-arm-kernel, Sören Brinkmann,
	linux-kernel, Dan Williams, dmaengine, linuxppc-dev

Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
T *d;
expression e;
statement S;
@@

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

@@
expression d,e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(*d));
// </smpl>

---

 drivers/crypto/marvell/tdma.c    |    5 ++---
 drivers/dma/fsldma.c             |    3 +--
 drivers/dma/ioat/init.c          |    5 ++---
 drivers/dma/mmp_pdma.c           |    3 +--
 drivers/dma/xilinx/xilinx_vdma.c |    3 +--
 5 files changed, 7 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/5] crypto: Use dma_pool_zalloc
  2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
@ 2016-04-29 20:09 ` Julia Lawall
  2016-04-29 20:37   ` Boris Brezillon
  2016-05-03  8:17   ` Herbert Xu
  2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul
  1 sibling, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2016-04-29 20:09 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: kernel-janitors, Arnaud Ebalard, Herbert Xu, David S. Miller,
	linux-crypto, linux-kernel

Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression d,e;
statement S;
@@

        d =
-            dma_pool_alloc
+            dma_pool_zalloc
             (...);
        if (!d) S
-       memset(d, 0, sizeof(*d));
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

 drivers/crypto/marvell/tdma.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/marvell/tdma.c b/drivers/crypto/marvell/tdma.c
index 7642798..0ad8f1e 100644
--- a/drivers/crypto/marvell/tdma.c
+++ b/drivers/crypto/marvell/tdma.c
@@ -99,12 +99,11 @@ mv_cesa_dma_add_desc(struct mv_cesa_tdma_chain *chain, gfp_t flags)
 	struct mv_cesa_tdma_desc *new_tdma = NULL;
 	dma_addr_t dma_handle;
 
-	new_tdma = dma_pool_alloc(cesa_dev->dma->tdma_desc_pool, flags,
-				  &dma_handle);
+	new_tdma = dma_pool_zalloc(cesa_dev->dma->tdma_desc_pool, flags,
+				   &dma_handle);
 	if (!new_tdma)
 		return ERR_PTR(-ENOMEM);
 
-	memset(new_tdma, 0, sizeof(*new_tdma));
 	new_tdma->cur_dma = dma_handle;
 	if (chain->last) {
 		chain->last->next_dma = cpu_to_le32(dma_handle);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] crypto: Use dma_pool_zalloc
  2016-04-29 20:09 ` [PATCH 4/5] crypto: " Julia Lawall
@ 2016-04-29 20:37   ` Boris Brezillon
  2016-05-03  8:17   ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Boris Brezillon @ 2016-04-29 20:37 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Arnaud Ebalard, Herbert Xu, David S. Miller,
	linux-crypto, linux-kernel

On Fri, 29 Apr 2016 22:09:11 +0200
Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
> that makes this transformation is as follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression d,e;
> statement S;
> @@
> 
>         d =
> -            dma_pool_alloc
> +            dma_pool_zalloc
>              (...);
>         if (!d) S
> -       memset(d, 0, sizeof(*d));
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> 
> ---
> 
>  drivers/crypto/marvell/tdma.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/marvell/tdma.c b/drivers/crypto/marvell/tdma.c
> index 7642798..0ad8f1e 100644
> --- a/drivers/crypto/marvell/tdma.c
> +++ b/drivers/crypto/marvell/tdma.c
> @@ -99,12 +99,11 @@ mv_cesa_dma_add_desc(struct mv_cesa_tdma_chain *chain, gfp_t flags)
>  	struct mv_cesa_tdma_desc *new_tdma = NULL;
>  	dma_addr_t dma_handle;
>  
> -	new_tdma = dma_pool_alloc(cesa_dev->dma->tdma_desc_pool, flags,
> -				  &dma_handle);
> +	new_tdma = dma_pool_zalloc(cesa_dev->dma->tdma_desc_pool, flags,
> +				   &dma_handle);
>  	if (!new_tdma)
>  		return ERR_PTR(-ENOMEM);
>  
> -	memset(new_tdma, 0, sizeof(*new_tdma));
>  	new_tdma->cur_dma = dma_handle;
>  	if (chain->last) {
>  		chain->last->next_dma = cpu_to_le32(dma_handle);



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/5] Use dma_pool_zalloc
  2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
  2016-04-29 20:09 ` [PATCH 4/5] crypto: " Julia Lawall
@ 2016-05-03  6:55 ` Vinod Koul
  1 sibling, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2016-05-03  6:55 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-crypto, kernel-janitors, linux-arm-kernel,
	Sören Brinkmann, linux-kernel, Dan Williams, dmaengine,
	linuxppc-dev

On Fri, Apr 29, 2016 at 10:09:07PM +0200, Julia Lawall wrote:
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
> that makes this transformation is as follows: (http://coccinelle.lip6.fr/)

Applied all dmaengine patches

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4/5] crypto: Use dma_pool_zalloc
  2016-04-29 20:09 ` [PATCH 4/5] crypto: " Julia Lawall
  2016-04-29 20:37   ` Boris Brezillon
@ 2016-05-03  8:17   ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2016-05-03  8:17 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Boris Brezillon, kernel-janitors, Arnaud Ebalard, David S. Miller,
	linux-crypto, linux-kernel

On Fri, Apr 29, 2016 at 10:09:11PM +0200, Julia Lawall wrote:
> Dma_pool_zalloc combines dma_pool_alloc and memset 0.  The semantic patch
> that makes this transformation is as follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression d,e;
> statement S;
> @@
> 
>         d =
> -            dma_pool_alloc
> +            dma_pool_zalloc
>              (...);
>         if (!d) S
> -       memset(d, 0, sizeof(*d));
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-03  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29 20:09 [PATCH 0/5] Use dma_pool_zalloc Julia Lawall
2016-04-29 20:09 ` [PATCH 4/5] crypto: " Julia Lawall
2016-04-29 20:37   ` Boris Brezillon
2016-05-03  8:17   ` Herbert Xu
2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).