linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc
@ 2018-10-18 16:06 Sabyasachi Gupta
  2018-10-18 16:18 ` Jinpu Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sabyasachi Gupta @ 2018-10-18 16:06 UTC (permalink / raw)
  To: jejb, martin.petersen, keescook, john.garry, jinpu.wang
  Cc: jrdr.linux, linux-scsi, linux-kernel, brajeswar.linux

Replaced dma_pool_alloc + memset with dma_pool_zalloc
Signed-off-by: Sabyasachi Gupta <sabyasachi.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];
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc
  2018-10-18 16:06 [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc Sabyasachi Gupta
@ 2018-10-18 16:18 ` Jinpu Wang
  2018-10-18 16:32 ` John Garry
  2018-10-24  1:26 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Jinpu Wang @ 2018-10-18 16:18 UTC (permalink / raw)
  To: sabyasachi.linux
  Cc: James E.J. Bottomley, Martin K. Petersen, Kees Cook, John Garry,
	jrdr.linux, Linux SCSI Mailinglist, linux-kernel,
	brajeswar.linux

On Thu, Oct 18, 2018 at 6:06 PM Sabyasachi Gupta
<sabyasachi.linux@gmail.com> wrote:
>
> Replaced dma_pool_alloc + memset with dma_pool_zalloc
> Signed-off-by: Sabyasachi Gupta <sabyasachi.linux@gmail.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Thanks!
> ---
>  drivers/scsi/mvsas/mv_sas.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)



-- 
Jack Wang
Linux Kernel Developer

ProfitBricks GmbH
Greifswalder Str. 207
D - 10405 Berlin

Tel:       +49 30 577 008  042
Fax:      +49 30 577 008 299
Email:    jinpu.wang@profitbricks.com
URL:      https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg, Christoph Steffens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc
  2018-10-18 16:06 [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc Sabyasachi Gupta
  2018-10-18 16:18 ` Jinpu Wang
@ 2018-10-18 16:32 ` John Garry
  2018-10-24  1:26 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: John Garry @ 2018-10-18 16:32 UTC (permalink / raw)
  To: Sabyasachi Gupta, jejb, martin.petersen, keescook, jinpu.wang
  Cc: jrdr.linux, linux-scsi, linux-kernel, brajeswar.linux

On 18/10/2018 17:06, Sabyasachi Gupta wrote:
> Replaced dma_pool_alloc + memset with dma_pool_zalloc
> Signed-off-by: Sabyasachi Gupta <sabyasachi.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);
>

How about also fixing these, below, up to use dma_zalloc_coherent() or 
even dmam_alloc_coherent() [as they're manually free'd at removal]:

static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
{
     int i = 0, slot_nr;
     char pool_name[32];
...
     /*
      * alloc and init our DMA areas
      */
     mvi->tx = dma_alloc_coherent(mvi->dev,
                      sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ,
                      &mvi->tx_dma, GFP_KERNEL);
     if (!mvi->tx)
         goto err_out;
     memset(mvi->tx, 0, sizeof(*mvi->tx) * MVS_CHIP_SLOT_SZ);

...

Thanks,
John

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc
  2018-10-18 16:06 [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc Sabyasachi Gupta
  2018-10-18 16:18 ` Jinpu Wang
  2018-10-18 16:32 ` John Garry
@ 2018-10-24  1:26 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2018-10-24  1:26 UTC (permalink / raw)
  To: Sabyasachi Gupta
  Cc: jejb, martin.petersen, keescook, john.garry, jinpu.wang,
	jrdr.linux, linux-scsi, linux-kernel, brajeswar.linux


Sabyasachi,

> Replaced dma_pool_alloc + memset with dma_pool_zalloc

Applied to 4.20/scsi-queue, thank you.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-24  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 16:06 [PATCH] scsi/mvsas/mv_sas.c: Use dma_pool_zalloc Sabyasachi Gupta
2018-10-18 16:18 ` Jinpu Wang
2018-10-18 16:32 ` John Garry
2018-10-24  1:26 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).