diff options
author | Himanshu Jha <himanshujha199640@gmail.com> | 2017-12-31 17:54:23 +0530 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-01-12 23:02:56 +1100 |
commit | 75d68369b544acc5d14c18a827654dfff248d09d (patch) | |
tree | 28a59ee3d94752e1f90f4e76399c7da10d99f224 /drivers/crypto/ixp4xx_crypto.c | |
parent | b7dac3731848923399c7a92563e3754e8f3b5236 (diff) | |
download | lwn-75d68369b544acc5d14c18a827654dfff248d09d.tar.gz lwn-75d68369b544acc5d14c18a827654dfff248d09d.zip |
crypto: Use zeroing memory allocator instead of allocator/memset
Use dma_zalloc_coherent for allocating zeroed
memory and remove unnecessary memset function.
Done using Coccinelle.
Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
0-day tested with no failures.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ixp4xx_crypto.c')
-rw-r--r-- | drivers/crypto/ixp4xx_crypto.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 8705b28eb02c..717a26607bdb 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -260,12 +260,11 @@ static int setup_crypt_desc(void) { struct device *dev = &pdev->dev; BUILD_BUG_ON(sizeof(struct crypt_ctl) != 64); - crypt_virt = dma_alloc_coherent(dev, - NPE_QLEN * sizeof(struct crypt_ctl), - &crypt_phys, GFP_ATOMIC); + crypt_virt = dma_zalloc_coherent(dev, + NPE_QLEN * sizeof(struct crypt_ctl), + &crypt_phys, GFP_ATOMIC); if (!crypt_virt) return -ENOMEM; - memset(crypt_virt, 0, NPE_QLEN * sizeof(struct crypt_ctl)); return 0; } |