diff mbox

scsi: mvsas: Use dma_pool_zalloc()

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

Commit Message

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

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
 drivers/scsi/mvsas/mv_sas.c | 3 +--
 1 file changed, 1 insertion(+), 2 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 9:28 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/mvsas/mv_sas.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
> index cff43bd..d00d37d 100644
> --- a/drivers/scsi/mvsas/mv_sas.c
> +++ b/drivers/scsi/mvsas/mv_sas.c
> @@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
>         slot->n_elem = n_elem;
>         slot->slot_tag = tag;
>
> -       slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
> +       slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
>         if (!slot->buf) {
>                 rc = -ENOMEM;
>                 goto err_out_tag;
>         }
> -       memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>
>         tei.task = task;
>         tei.hdr = &mvi->slot[tag];
> --
> 1.9.1
>
Souptick Joarder March 14, 2018, 6:06 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 9:28 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/mvsas/mv_sas.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>> index cff43bd..d00d37d 100644
>> --- a/drivers/scsi/mvsas/mv_sas.c
>> +++ b/drivers/scsi/mvsas/mv_sas.c
>> @@ -790,12 +790,11 @@ static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
>>         slot->n_elem = n_elem;
>>         slot->slot_tag = tag;
>>
>> -       slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
>> +       slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
>>         if (!slot->buf) {
>>                 rc = -ENOMEM;
>>                 goto err_out_tag;
>>         }
>> -       memset(slot->buf, 0, MVS_SLOT_BUF_SZ);
>>
>>         tei.task = task;
>>         tei.hdr = &mvi->slot[tag];
>> --
>> 1.9.1
>>

-Souptick
diff mbox

Patch

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index cff43bd..d00d37d 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -790,12 +790,11 @@  static int mvs_task_prep(struct sas_task *task, struct mvs_info *mvi, int is_tmf
 	slot->n_elem = n_elem;
 	slot->slot_tag = tag;

-	slot->buf = dma_pool_alloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
+	slot->buf = dma_pool_zalloc(mvi->dma_pool, GFP_ATOMIC, &slot->buf_dma);
 	if (!slot->buf) {
 		rc = -ENOMEM;
 		goto err_out_tag;
 	}
-	memset(slot->buf, 0, MVS_SLOT_BUF_SZ);

 	tei.task = task;
 	tei.hdr = &mvi->slot[tag];