Skip to content

Commit

Permalink
crypto: ccp - Replace dma_pool_alloc + memset with dma_pool_zalloc
Browse files Browse the repository at this point in the history
Use dma_pool_zalloc instead of using dma_pool_alloc to allocate
memory and then zeroing it with memset 0.
This simplifies the code.

Signed-off-by: Chuhong Yuan <[email protected]>
Acked-by: Gary R Hook <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
WillLester authored and herbertx committed Jul 27, 2019
1 parent 6ed0109 commit bfb5eb0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/crypto/ccp/ccp-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,13 @@ static int ccp_init_dm_workarea(struct ccp_dm_workarea *wa,
if (len <= CCP_DMAPOOL_MAX_SIZE) {
wa->dma_pool = cmd_q->dma_pool;

wa->address = dma_pool_alloc(wa->dma_pool, GFP_KERNEL,
wa->address = dma_pool_zalloc(wa->dma_pool, GFP_KERNEL,
&wa->dma.address);
if (!wa->address)
return -ENOMEM;

wa->dma.length = CCP_DMAPOOL_MAX_SIZE;

memset(wa->address, 0, CCP_DMAPOOL_MAX_SIZE);
} else {
wa->address = kzalloc(len, GFP_KERNEL);
if (!wa->address)
Expand Down

0 comments on commit bfb5eb0

Please sign in to comment.