crypto: ccp - Replace dma_pool_alloc + memset with dma_pool_zalloc
diff mbox series

Message ID 20190718131609.10974-1-hslester96@gmail.com
State Accepted
Delegated to: Herbert Xu
Headers show
Series
  • crypto: ccp - Replace dma_pool_alloc + memset with dma_pool_zalloc
Related show

Commit Message

Chuhong Yuan July 18, 2019, 1:16 p.m. UTC
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 <hslester96@gmail.com>
---
 drivers/crypto/ccp/ccp-ops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Gary R Hook July 18, 2019, 9:50 p.m. UTC | #1
On 7/18/19 8:16 AM, Chuhong Yuan wrote:
> 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 <hslester96@gmail.com>

Acked-by: Gary R Hook <gary.hook@amd.com>

> ---
>   drivers/crypto/ccp/ccp-ops.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
> index 866b2e05ca77..03797c42b336 100644
> --- a/drivers/crypto/ccp/ccp-ops.c
> +++ b/drivers/crypto/ccp/ccp-ops.c
> @@ -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)
>
Herbert Xu July 26, 2019, 12:35 p.m. UTC | #2
Chuhong Yuan <hslester96@gmail.com> wrote:
> 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 <hslester96@gmail.com>
> ---
> drivers/crypto/ccp/ccp-ops.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.

Patch
diff mbox series

diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
index 866b2e05ca77..03797c42b336 100644
--- a/drivers/crypto/ccp/ccp-ops.c
+++ b/drivers/crypto/ccp/ccp-ops.c
@@ -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)