diff mbox

scsi: aic94xx: Use dma_pool_zalloc()

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

Commit Message

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

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

--
1.9.1

Comments

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

On Thu, Feb 15, 2018 at 10:09 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/aic94xx/aic94xx_hwi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
> index 2dbc833..1b13133 100644
> --- a/drivers/scsi/aic94xx/aic94xx_hwi.c
> +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
> @@ -1055,14 +1055,13 @@ static struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha,
>
>         if (ascb) {
>                 ascb->dma_scb.size = sizeof(struct scb);
> -               ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
> +               ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
>                                                      gfp_flags,
>                                                     &ascb->dma_scb.dma_handle);
>                 if (!ascb->dma_scb.vaddr) {
>                         kmem_cache_free(asd_ascb_cache, ascb);
>                         return NULL;
>                 }
> -               memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
>                 asd_init_ascb(asd_ha, ascb);
>
>                 spin_lock_irqsave(&seq->tc_index_lock, flags);
> --
> 1.9.1
>
Souptick Joarder March 14, 2018, 6:05 a.m. UTC | #2
Hi Martin,

Any comment for this patch ?

On Wed, Mar 7, 2018 at 2:25 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> Any comment for this patch.
>
> On Thu, Feb 15, 2018 at 10:09 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/aic94xx/aic94xx_hwi.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
>> index 2dbc833..1b13133 100644
>> --- a/drivers/scsi/aic94xx/aic94xx_hwi.c
>> +++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
>> @@ -1055,14 +1055,13 @@ static struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha,
>>
>>         if (ascb) {
>>                 ascb->dma_scb.size = sizeof(struct scb);
>> -               ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
>> +               ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
>>                                                      gfp_flags,
>>                                                     &ascb->dma_scb.dma_handle);
>>                 if (!ascb->dma_scb.vaddr) {
>>                         kmem_cache_free(asd_ascb_cache, ascb);
>>                         return NULL;
>>                 }
>> -               memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
>>                 asd_init_ascb(asd_ha, ascb);
>>
>>                 spin_lock_irqsave(&seq->tc_index_lock, flags);
>> --
>> 1.9.1
>>

-Souptick
Martin K. Petersen March 15, 2018, 4:50 a.m. UTC | #3
Souptick,

> Any comment for this patch ?

-ENOREVIEWS

Also, you have not provided potential reviewers with a compelling reason
why dma_pool_zalloc() is superior to alloc+memset.
Souptick Joarder March 15, 2018, 5:10 a.m. UTC | #4
On Thu, Mar 15, 2018 at 10:20 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>
> Souptick,
>
>> Any comment for this patch ?
>
> -ENOREVIEWS
>
> Also, you have not provided potential reviewers with a compelling reason
> why dma_pool_zalloc() is superior to alloc+memset.
>

dma_pool_zalloc() is the API which can replace dma_pool_alloc + memeset.
I have identified all the possible areas in kernel and send patches
for the same.
This patch is part of same change.

As there is no separate maintainer for /scsi/ aic94xx in Maintainer file, send
this patch to scsi mailing list.

Shall I request Andrew Morton to review this patch in case noone is
reviewing this patch?

> --
> Martin K. Petersen      Oracle Linux Engineering

-Souptick
diff mbox

Patch

diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 2dbc833..1b13133 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -1055,14 +1055,13 @@  static struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha,

 	if (ascb) {
 		ascb->dma_scb.size = sizeof(struct scb);
-		ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
+		ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool,
 						     gfp_flags,
 						    &ascb->dma_scb.dma_handle);
 		if (!ascb->dma_scb.vaddr) {
 			kmem_cache_free(asd_ascb_cache, ascb);
 			return NULL;
 		}
-		memset(ascb->dma_scb.vaddr, 0, sizeof(struct scb));
 		asd_init_ascb(asd_ha, ascb);

 		spin_lock_irqsave(&seq->tc_index_lock, flags);