diff mbox series

[3/4] drivers/scsi/snic/snic_trc: Use vzalloc instead of vmalloc+memset

Message ID 1533129976-51930-4-git-send-email-zhongjiang@huawei.com (mailing list archive)
State Changes Requested
Headers show
Series use dma_zalloc_coherent and vzalloc to replace open code | expand

Commit Message

zhong jiang Aug. 1, 2018, 1:26 p.m. UTC
The vzmalloc is better than vmalloc+memset, so replace them.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/scsi/snic/snic_trc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andy Shevchenko Aug. 1, 2018, 3:33 p.m. UTC | #1
On Wed, Aug 1, 2018 at 4:26 PM, zhong jiang <zhongjiang@huawei.com> wrote:
> The vzmalloc is better than vmalloc+memset, so replace them.
>

FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/scsi/snic/snic_trc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/snic/snic_trc.c b/drivers/scsi/snic/snic_trc.c
> index fc60c93..876c490 100644
> --- a/drivers/scsi/snic/snic_trc.c
> +++ b/drivers/scsi/snic/snic_trc.c
> @@ -126,7 +126,7 @@ struct snic_trc_data *
>         int tbuf_sz = 0, ret;
>
>         tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
> -       tbuf = vmalloc(tbuf_sz);
> +       tbuf = vzmalloc(tbuf_sz);
>         if (!tbuf) {
>                 SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
>                 SNIC_ERR("Trace Facility not enabled.\n");
> @@ -135,7 +135,6 @@ struct snic_trc_data *
>                 return ret;
>         }
>
> -       memset(tbuf, 0, tbuf_sz);
>         trc->buf = (struct snic_trc_data *) tbuf;
>         spin_lock_init(&trc->lock);
>
> --
> 1.7.12.4
>
diff mbox series

Patch

diff --git a/drivers/scsi/snic/snic_trc.c b/drivers/scsi/snic/snic_trc.c
index fc60c93..876c490 100644
--- a/drivers/scsi/snic/snic_trc.c
+++ b/drivers/scsi/snic/snic_trc.c
@@ -126,7 +126,7 @@  struct snic_trc_data *
 	int tbuf_sz = 0, ret;
 
 	tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
-	tbuf = vmalloc(tbuf_sz);
+	tbuf = vzmalloc(tbuf_sz);
 	if (!tbuf) {
 		SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
 		SNIC_ERR("Trace Facility not enabled.\n");
@@ -135,7 +135,6 @@  struct snic_trc_data *
 		return ret;
 	}
 
-	memset(tbuf, 0, tbuf_sz);
 	trc->buf = (struct snic_trc_data *) tbuf;
 	spin_lock_init(&trc->lock);