crypto: ccp - use kmem_cache_zalloc instead of kmem_cache_alloc/memset
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 15 Sep 2016 03:28:04 +0000 (03:28 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 22 Sep 2016 10:27:37 +0000 (18:27 +0800)
Using kmem_cache_zalloc() instead of kmem_cache_alloc() and memset().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dmaengine.c

index ded26f46c7350cefa108b9cdaf9ff89050e4df0a..2e5a05ce0e3e9d12dc4a32b752faa3da35ba3bd9 100644 (file)
@@ -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;