nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0)
@ 2021-05-31  1:48 Wu Bo
  2021-06-04  0:48 ` Wu Bo
  2021-06-04  6:48 ` Santosh Sivaraj
  0 siblings, 2 replies; 3+ messages in thread
From: Wu Bo @ 2021-05-31  1:48 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny, bp,
	rafael.j.wysocki, mpe, nvdimm, linux-kernel
  Cc: linfeilong, wubo40

Use vzalloc() instead of vmalloc() and memset(0) to simpify
the code.

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 tools/testing/nvdimm/test/nfit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 54f367cbadae..258bba22780b 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -1625,7 +1625,6 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
 	if (rc)
 		goto err;
 	INIT_LIST_HEAD(&nfit_res->list);
-	memset(buf, 0, size);
 	nfit_res->dev = dev;
 	nfit_res->buf = buf;
 	nfit_res->res.start = *dma;
@@ -1652,7 +1651,7 @@ static void *test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma)
 	struct genpool_data_align data = {
 		.align = SZ_128M,
 	};
-	void *buf = vmalloc(size);
+	void *buf = vzalloc(size);
 
 	if (size >= DIMM_SIZE)
 		*dma = gen_pool_alloc_algo(nfit_pool, size,
-- 
2.30.0


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

* Re: [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0)
  2021-05-31  1:48 [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0) Wu Bo
@ 2021-06-04  0:48 ` Wu Bo
  2021-06-04  6:48 ` Santosh Sivaraj
  1 sibling, 0 replies; 3+ messages in thread
From: Wu Bo @ 2021-06-04  0:48 UTC (permalink / raw)
  To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny, bp,
	rafael.j.wysocki, mpe, nvdimm, linux-kernel
  Cc: linfeilong

Friendly ping ...

On 2021/5/31 9:48, Wu Bo wrote:
> Use vzalloc() instead of vmalloc() and memset(0) to simpify
> the code.
> 
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---
>   tools/testing/nvdimm/test/nfit.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 54f367cbadae..258bba22780b 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1625,7 +1625,6 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
>   	if (rc)
>   		goto err;
>   	INIT_LIST_HEAD(&nfit_res->list);
> -	memset(buf, 0, size);
>   	nfit_res->dev = dev;
>   	nfit_res->buf = buf;
>   	nfit_res->res.start = *dma;
> @@ -1652,7 +1651,7 @@ static void *test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma)
>   	struct genpool_data_align data = {
>   		.align = SZ_128M,
>   	};
> -	void *buf = vmalloc(size);
> +	void *buf = vzalloc(size);
>   
>   	if (size >= DIMM_SIZE)
>   		*dma = gen_pool_alloc_algo(nfit_pool, size,
> 


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

* Re: [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0)
  2021-05-31  1:48 [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0) Wu Bo
  2021-06-04  0:48 ` Wu Bo
@ 2021-06-04  6:48 ` Santosh Sivaraj
  1 sibling, 0 replies; 3+ messages in thread
From: Santosh Sivaraj @ 2021-06-04  6:48 UTC (permalink / raw)
  To: Wu Bo, dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny, bp,
	rafael.j.wysocki, mpe, nvdimm, linux-kernel
  Cc: linfeilong, wubo40

Wu Bo <wubo40@huawei.com> writes:

> Use vzalloc() instead of vmalloc() and memset(0) to simpify
> the code.
>
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---
>  tools/testing/nvdimm/test/nfit.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

LGTM,

Reviewed-by: Santosh S <santosh@fossix.org>

>
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 54f367cbadae..258bba22780b 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1625,7 +1625,6 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
>  	if (rc)
>  		goto err;
>  	INIT_LIST_HEAD(&nfit_res->list);
> -	memset(buf, 0, size);
>  	nfit_res->dev = dev;
>  	nfit_res->buf = buf;
>  	nfit_res->res.start = *dma;
> @@ -1652,7 +1651,7 @@ static void *test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma)
>  	struct genpool_data_align data = {
>  		.align = SZ_128M,
>  	};
> -	void *buf = vmalloc(size);
> +	void *buf = vzalloc(size);
>  
>  	if (size >= DIMM_SIZE)
>  		*dma = gen_pool_alloc_algo(nfit_pool, size,
> -- 
> 2.30.0

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

end of thread, other threads:[~2021-06-04  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  1:48 [PATCH] tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0) Wu Bo
2021-06-04  0:48 ` Wu Bo
2021-06-04  6:48 ` Santosh Sivaraj

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).