diff mbox

[-next] crypto: ccp - use kmem_cache_zalloc instead of kmem_cache_alloc/memset

Message ID 1473910084-31739-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Wei Yongjun Sept. 15, 2016, 3:28 a.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/crypto/ccp/ccp-dmaengine.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Gary R Hook Sept. 19, 2016, 3:10 p.m. UTC | #1
On 09/14/2016 10:28 PM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/crypto/ccp/ccp-dmaengine.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c
> index ded26f4..2e5a05c 100644
> --- a/drivers/crypto/ccp/ccp-dmaengine.c
> +++ b/drivers/crypto/ccp/ccp-dmaengine.c
> @@ -299,12 +299,10 @@ static struct ccp_dma_desc *ccp_alloc_dma_desc(struct ccp_dma_chan *chan,
>  {
>  	struct ccp_dma_desc *desc;
>
> -	desc = kmem_cache_alloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
> +	desc = kmem_cache_zalloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
>  	if (!desc)
>  		return NULL;
>
> -	memset(desc, 0, sizeof(*desc));
> -
>  	dma_async_tx_descriptor_init(&desc->tx_desc, &chan->dma_chan);
>  	desc->tx_desc.flags = flags;
>  	desc->tx_desc.tx_submit = ccp_tx_submit;
>

Acked-by: Gary R Hook <gary.hook@amd.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu Sept. 22, 2016, 10:43 a.m. UTC | #2
On Thu, Sep 15, 2016 at 03:28:04AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c
index ded26f4..2e5a05c 100644
--- a/drivers/crypto/ccp/ccp-dmaengine.c
+++ b/drivers/crypto/ccp/ccp-dmaengine.c
@@ -299,12 +299,10 @@  static struct ccp_dma_desc *ccp_alloc_dma_desc(struct ccp_dma_chan *chan,
 {
 	struct ccp_dma_desc *desc;
 
-	desc = kmem_cache_alloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
+	desc = kmem_cache_zalloc(chan->ccp->dma_desc_cache, GFP_NOWAIT);
 	if (!desc)
 		return NULL;
 
-	memset(desc, 0, sizeof(*desc));
-
 	dma_async_tx_descriptor_init(&desc->tx_desc, &chan->dma_chan);
 	desc->tx_desc.flags = flags;
 	desc->tx_desc.tx_submit = ccp_tx_submit;