diff mbox

scsi: pmcraid: Use dma_pool_zalloc()

Message ID 20180215151438.GA8253@jordon-HP-15-Notebook-PC (mailing list archive)
State Deferred
Headers show

Commit Message

Souptick Joarder Feb. 15, 2018, 3:14 p.m. UTC
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

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

--
1.9.1

Comments

Souptick Joarder March 6, 2018, 8:01 a.m. UTC | #1
Any comment for this patch.

On Thu, Feb 15, 2018 at 8:44 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>  drivers/scsi/pmcraid.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
> index 201c8de..7535161 100644
> --- a/drivers/scsi/pmcraid.c
> +++ b/drivers/scsi/pmcraid.c
> @@ -4716,7 +4716,7 @@ static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
>
>         for (i = 0; i < PMCRAID_MAX_CMD; i++) {
>                 pinstance->cmd_list[i]->ioa_cb =
> -                       dma_pool_alloc(
> +                       dma_pool_zalloc(
>                                 pinstance->control_pool,
>                                 GFP_KERNEL,
>                                 &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
> @@ -4725,8 +4725,6 @@ static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
>                         pmcraid_release_control_blocks(pinstance, i);
>                         return -ENOMEM;
>                 }
> -               memset(pinstance->cmd_list[i]->ioa_cb, 0,
> -                       sizeof(struct pmcraid_control_block));
>         }
>         return 0;
>  }
> --
> 1.9.1
>
Souptick Joarder March 14, 2018, 6:07 a.m. UTC | #2
Hi Martin,

Any comment for this patch ?

On Tue, Mar 6, 2018 at 1:31 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> Any comment for this patch.
>
> On Thu, Feb 15, 2018 at 8:44 PM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> Use dma_pool_zalloc() instead of dma_pool_alloc + memset
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> ---
>>  drivers/scsi/pmcraid.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
>> index 201c8de..7535161 100644
>> --- a/drivers/scsi/pmcraid.c
>> +++ b/drivers/scsi/pmcraid.c
>> @@ -4716,7 +4716,7 @@ static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
>>
>>         for (i = 0; i < PMCRAID_MAX_CMD; i++) {
>>                 pinstance->cmd_list[i]->ioa_cb =
>> -                       dma_pool_alloc(
>> +                       dma_pool_zalloc(
>>                                 pinstance->control_pool,
>>                                 GFP_KERNEL,
>>                                 &(pinstance->cmd_list[i]->ioa_cb_bus_addr));
>> @@ -4725,8 +4725,6 @@ static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
>>                         pmcraid_release_control_blocks(pinstance, i);
>>                         return -ENOMEM;
>>                 }
>> -               memset(pinstance->cmd_list[i]->ioa_cb, 0,
>> -                       sizeof(struct pmcraid_control_block));
>>         }
>>         return 0;
>>  }
>> --
>> 1.9.1
>>

-Souptick
diff mbox

Patch

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 201c8de..7535161 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4716,7 +4716,7 @@  static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)

 	for (i = 0; i < PMCRAID_MAX_CMD; i++) {
 		pinstance->cmd_list[i]->ioa_cb =
-			dma_pool_alloc(
+			dma_pool_zalloc(
 				pinstance->control_pool,
 				GFP_KERNEL,
 				&(pinstance->cmd_list[i]->ioa_cb_bus_addr));
@@ -4725,8 +4725,6 @@  static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
 			pmcraid_release_control_blocks(pinstance, i);
 			return -ENOMEM;
 		}
-		memset(pinstance->cmd_list[i]->ioa_cb, 0,
-			sizeof(struct pmcraid_control_block));
 	}
 	return 0;
 }