linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org,
	Arnaud Ebalard <arno@natisbad.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] crypto: Use dma_pool_zalloc
Date: Fri, 29 Apr 2016 22:37:50 +0200	[thread overview]
Message-ID: <20160429223750.3a7b6849@bbrezillon> (raw)
In-Reply-To: <1461960552-7429-5-git-send-email-Julia.Lawall@lip6.fr>

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

  reply	other threads:[~2016-04-29 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-05-03  8:17   ` Herbert Xu
2016-05-03  6:55 ` [PATCH 0/5] " Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160429223750.3a7b6849@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=arno@natisbad.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).