57823fad0ca1f2d9d9991c434a3b28125d47b666
[openwrt/staging/hauke.git] /
1 From 75d68369b544acc5d14c18a827654dfff248d09d Mon Sep 17 00:00:00 2001
2 From: Himanshu Jha <himanshujha199640@gmail.com>
3 Date: Sun, 31 Dec 2017 17:54:23 +0530
4 Subject: [PATCH 1/8] crypto: Use zeroing memory allocator instead of
5 allocator/memset
6
7 Use dma_zalloc_coherent for allocating zeroed
8 memory and remove unnecessary memset function.
9
10 Done using Coccinelle.
11 Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
12 0-day tested with no failures.
13
14 Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
15 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
16 ---
17 drivers/crypto/amcc/crypto4xx_core.c | 8 +++-----
18 1 file changed, 3 insertions(+), 5 deletions(-)
19
20 --- a/drivers/crypto/amcc/crypto4xx_core.c
21 +++ b/drivers/crypto/amcc/crypto4xx_core.c
22 @@ -282,14 +282,12 @@ static u32 crypto4xx_put_pd_to_pdr(struc
23 */
24 static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
25 {
26 - dev->gdr = dma_alloc_coherent(dev->core_dev->device,
27 - sizeof(struct ce_gd) * PPC4XX_NUM_GD,
28 - &dev->gdr_pa, GFP_ATOMIC);
29 + dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
30 + sizeof(struct ce_gd) * PPC4XX_NUM_GD,
31 + &dev->gdr_pa, GFP_ATOMIC);
32 if (!dev->gdr)
33 return -ENOMEM;
34
35 - memset(dev->gdr, 0, sizeof(struct ce_gd) * PPC4XX_NUM_GD);
36 -
37 return 0;
38 }
39