2018-10-02 05:45:09

by Souptick Joarder

[permalink] [raw]
Subject: [PATCH] scsi/mpt3sas: Use dma_pool_zalloc

Replaced dma_pool_alloc + memset with dma_pool_zalloc.

Signed-off-by: Brajeswar Ghosh <[email protected]>
Signed-off-by: Souptick Joarder <[email protected]>
---
drivers/scsi/mpt3sas/mpt3sas_base.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 59d7844..d7ef671 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -4516,7 +4516,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
i = 0;
do {
ioc->reply_post[i].reply_post_free =
- dma_pool_alloc(ioc->reply_post_free_dma_pool,
+ dma_pool_zalloc(ioc->reply_post_free_dma_pool,
GFP_KERNEL,
&ioc->reply_post[i].reply_post_free_dma);
if (!ioc->reply_post[i].reply_post_free) {
@@ -4525,7 +4525,6 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
ioc->name);
goto out;
}
- memset(ioc->reply_post[i].reply_post_free, 0, sz);
dinitprintk(ioc, pr_info(MPT3SAS_FMT
"reply post free pool (0x%p): depth(%d),"
"element_size(%d), pool_size(%d kB)\n", ioc->name,
@@ -4852,14 +4851,13 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
ioc->name);
goto out;
}
- ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
+ ioc->reply_free = dma_pool_zalloc(ioc->reply_free_dma_pool, GFP_KERNEL,
&ioc->reply_free_dma);
if (!ioc->reply_free) {
pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
ioc->name);
goto out;
}
- memset(ioc->reply_free, 0, sz);
dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \
"depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name,
ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024));
--
1.9.1



2018-10-08 16:30:21

by Souptick Joarder

[permalink] [raw]
Subject: Re: [PATCH] scsi/mpt3sas: Use dma_pool_zalloc

On Tue, Oct 2, 2018 at 11:14 AM Souptick Joarder <[email protected]> wrote:
>
> Replaced dma_pool_alloc + memset with dma_pool_zalloc.
>
> Signed-off-by: Brajeswar Ghosh <[email protected]>
> Signed-off-by: Souptick Joarder <[email protected]>

Any comment on this patch ?
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 59d7844..d7ef671 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -4516,7 +4516,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> i = 0;
> do {
> ioc->reply_post[i].reply_post_free =
> - dma_pool_alloc(ioc->reply_post_free_dma_pool,
> + dma_pool_zalloc(ioc->reply_post_free_dma_pool,
> GFP_KERNEL,
> &ioc->reply_post[i].reply_post_free_dma);
> if (!ioc->reply_post[i].reply_post_free) {
> @@ -4525,7 +4525,6 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> ioc->name);
> goto out;
> }
> - memset(ioc->reply_post[i].reply_post_free, 0, sz);
> dinitprintk(ioc, pr_info(MPT3SAS_FMT
> "reply post free pool (0x%p): depth(%d),"
> "element_size(%d), pool_size(%d kB)\n", ioc->name,
> @@ -4852,14 +4851,13 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> ioc->name);
> goto out;
> }
> - ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
> + ioc->reply_free = dma_pool_zalloc(ioc->reply_free_dma_pool, GFP_KERNEL,
> &ioc->reply_free_dma);
> if (!ioc->reply_free) {
> pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
> ioc->name);
> goto out;
> }
> - memset(ioc->reply_free, 0, sz);
> dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \
> "depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name,
> ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024));
> --
> 1.9.1
>

2018-10-09 06:04:04

by Suganath Prabu S

[permalink] [raw]
Subject: Re: [PATCH] scsi/mpt3sas: Use dma_pool_zalloc

Looks good,
Please consider this patch as Acked-by: Suganath Prabu
<[email protected]>

Thanks

On Tue, Oct 2, 2018 at 11:14 AM Souptick Joarder <[email protected]> wrote:
>
> Replaced dma_pool_alloc + memset with dma_pool_zalloc.
>
> Signed-off-by: Brajeswar Ghosh <[email protected]>
> Signed-off-by: Souptick Joarder <[email protected]>
> ---
> drivers/scsi/mpt3sas/mpt3sas_base.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index 59d7844..d7ef671 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -4516,7 +4516,7 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> i = 0;
> do {
> ioc->reply_post[i].reply_post_free =
> - dma_pool_alloc(ioc->reply_post_free_dma_pool,
> + dma_pool_zalloc(ioc->reply_post_free_dma_pool,
> GFP_KERNEL,
> &ioc->reply_post[i].reply_post_free_dma);
> if (!ioc->reply_post[i].reply_post_free) {
> @@ -4525,7 +4525,6 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> ioc->name);
> goto out;
> }
> - memset(ioc->reply_post[i].reply_post_free, 0, sz);
> dinitprintk(ioc, pr_info(MPT3SAS_FMT
> "reply post free pool (0x%p): depth(%d),"
> "element_size(%d), pool_size(%d kB)\n", ioc->name,
> @@ -4852,14 +4851,13 @@ void mpt3sas_base_clear_st(struct MPT3SAS_ADAPTER *ioc,
> ioc->name);
> goto out;
> }
> - ioc->reply_free = dma_pool_alloc(ioc->reply_free_dma_pool, GFP_KERNEL,
> + ioc->reply_free = dma_pool_zalloc(ioc->reply_free_dma_pool, GFP_KERNEL,
> &ioc->reply_free_dma);
> if (!ioc->reply_free) {
> pr_err(MPT3SAS_FMT "reply_free pool: dma_pool_alloc failed\n",
> ioc->name);
> goto out;
> }
> - memset(ioc->reply_free, 0, sz);
> dinitprintk(ioc, pr_info(MPT3SAS_FMT "reply_free pool(0x%p): " \
> "depth(%d), element_size(%d), pool_size(%d kB)\n", ioc->name,
> ioc->reply_free, ioc->reply_free_queue_depth, 4, sz/1024));
> --
> 1.9.1
>

2018-10-11 02:06:15

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi/mpt3sas: Use dma_pool_zalloc


Souptick,

> Replaced dma_pool_alloc + memset with dma_pool_zalloc.

Applied to 4.20/scsi-queue, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2018-10-11 02:09:30

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] scsi/mpt3sas: Use dma_pool_zalloc


Suganath,

> Please consider this patch as Acked-by: Suganath Prabu
> <[email protected]>

Next time, please make sure to put

Acked-by: Suganath Prabu <[email protected]>

on a line by itself. Otherwise patchwork won't pick up the tag.

Thanks!

--
Martin K. Petersen Oracle Linux Engineering