diff mbox

scsi: ipr: Use dma_pool_zalloc()

Message ID 20180308131157.GA30730@jordon-HP-15-Notebook-PC (mailing list archive)
State Accepted
Headers show

Commit Message

Souptick Joarder March 8, 2018, 1:11 p.m. UTC
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
 drivers/scsi/ipr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
1.9.1

Comments

Brian King March 8, 2018, 9:51 p.m. UTC | #1
On 03/08/2018 07:11 AM, Souptick Joarder wrote:
> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>  drivers/scsi/ipr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
> index e07dd99..97387be 100644
> --- a/drivers/scsi/ipr.c
> +++ b/drivers/scsi/ipr.c
> @@ -9684,14 +9684,14 @@ static int ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
>  	}
> 
>  	for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
> -		ipr_cmd = dma_pool_alloc(ioa_cfg->ipr_cmd_pool, GFP_KERNEL, &dma_addr);
> +		ipr_cmd = dma_pool_zalloc(ioa_cfg->ipr_cmd_pool,
> +				GFP_KERNEL, &dma_addr);
> 
>  		if (!ipr_cmd) {
>  			ipr_free_cmd_blks(ioa_cfg);
>  			return -ENOMEM;
>  		}
> 
> -		memset(ipr_cmd, 0, sizeof(*ipr_cmd));
>  		ioa_cfg->ipr_cmnd_list[i] = ipr_cmd;
>  		ioa_cfg->ipr_cmnd_list_dma[i] = dma_addr;
> 
> --
> 1.9.1
> 

Acked-by: Brian King <brking@linux.vnet.ibm.com>
Martin K. Petersen March 13, 2018, 1:17 a.m. UTC | #2
Souptick,

> Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Applied to 4.17/scsi-queue. Thanks!
Souptick Joarder March 13, 2018, 4:37 a.m. UTC | #3
On Tue, Mar 13, 2018 at 6:47 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>
> Souptick,
>
>> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
> Applied to 4.17/scsi-queue. Thanks!

Thanks Martin :)
>
> --
> Martin K. Petersen      Oracle Linux Engineering
diff mbox

Patch

diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index e07dd99..97387be 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9684,14 +9684,14 @@  static int ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
 	}

 	for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
-		ipr_cmd = dma_pool_alloc(ioa_cfg->ipr_cmd_pool, GFP_KERNEL, &dma_addr);
+		ipr_cmd = dma_pool_zalloc(ioa_cfg->ipr_cmd_pool,
+				GFP_KERNEL, &dma_addr);

 		if (!ipr_cmd) {
 			ipr_free_cmd_blks(ioa_cfg);
 			return -ENOMEM;
 		}

-		memset(ipr_cmd, 0, sizeof(*ipr_cmd));
 		ioa_cfg->ipr_cmnd_list[i] = ipr_cmd;
 		ioa_cfg->ipr_cmnd_list_dma[i] = dma_addr;