diff mbox series

tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0)

Message ID 1622425715-146012-1-git-send-email-wubo40@huawei.com (mailing list archive)
State New
Headers show
Series tools/testing/nvdimm: use vzalloc() instead of vmalloc()/memset(0) | expand

Commit Message

Wu Bo May 31, 2021, 1:48 a.m. UTC
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(-)

Comments

Wu Bo June 4, 2021, 12:48 a.m. UTC | #1
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,
>
Santosh Sivaraj June 4, 2021, 6:48 a.m. UTC | #2
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
diff mbox series

Patch

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,