022-0001-crypto-Use-zeroing-memory-allocator-instead-of-alloc.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 75d68369b544acc5d14c18a827654dfff248d09d Mon Sep 17 00:00:00 2001
  2. From: Himanshu Jha <[email protected]>
  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. Use dma_zalloc_coherent for allocating zeroed
  7. memory and remove unnecessary memset function.
  8. Done using Coccinelle.
  9. Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
  10. 0-day tested with no failures.
  11. Signed-off-by: Himanshu Jha <[email protected]>
  12. Signed-off-by: Herbert Xu <[email protected]>
  13. ---
  14. drivers/crypto/amcc/crypto4xx_core.c | 8 +++-----
  15. 1 file changed, 3 insertions(+), 5 deletions(-)
  16. --- a/drivers/crypto/amcc/crypto4xx_core.c
  17. +++ b/drivers/crypto/amcc/crypto4xx_core.c
  18. @@ -282,14 +282,12 @@ static u32 crypto4xx_put_pd_to_pdr(struc
  19. */
  20. static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
  21. {
  22. - dev->gdr = dma_alloc_coherent(dev->core_dev->device,
  23. - sizeof(struct ce_gd) * PPC4XX_NUM_GD,
  24. - &dev->gdr_pa, GFP_ATOMIC);
  25. + dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
  26. + sizeof(struct ce_gd) * PPC4XX_NUM_GD,
  27. + &dev->gdr_pa, GFP_ATOMIC);
  28. if (!dev->gdr)
  29. return -ENOMEM;
  30. - memset(dev->gdr, 0, sizeof(struct ce_gd) * PPC4XX_NUM_GD);
  31. -
  32. return 0;
  33. }