diff mbox series

ndtest: Remove redundant NULL check

Message ID 20221113112653.12304-1-tegongkang@gmail.com (mailing list archive)
State New, archived
Headers show
Series ndtest: Remove redundant NULL check | expand

Commit Message

Kang Minchul Nov. 13, 2022, 11:26 a.m. UTC
This addresses cocci warning as follows:
WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
---
 tools/testing/nvdimm/test/ndtest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Kang Minchul Nov. 13, 2022, 11:32 a.m. UTC | #1
2022년 11월 13일 (일) 오후 8:26, Kang Minchul <tegongkang@gmail.com>님이 작성:
>
> This addresses cocci warning as follows:
> WARNING: NULL check before some freeing functions is not needed.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
> ---
>  tools/testing/nvdimm/test/ndtest.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
> index 01ceb98c15a0..de4bc34bc47b 100644
> --- a/tools/testing/nvdimm/test/ndtest.c
> +++ b/tools/testing/nvdimm/test/ndtest.c
> @@ -370,8 +370,7 @@ static void *ndtest_alloc_resource(struct ndtest_priv *p, size_t size,
>  buf_err:
>         if (__dma && size >= DIMM_SIZE)
>                 gen_pool_free(ndtest_pool, __dma, size);
> -       if (buf)
> -               vfree(buf);
> +       vfree(buf);
>         kfree(res);
>
>         return NULL;
> --
> 2.34.1
>

I just found an earlier discussion about the same patch as mine.
Please ignore this patch.

Thanks.

Kang Minchul
diff mbox series

Patch

diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 01ceb98c15a0..de4bc34bc47b 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -370,8 +370,7 @@  static void *ndtest_alloc_resource(struct ndtest_priv *p, size_t size,
 buf_err:
 	if (__dma && size >= DIMM_SIZE)
 		gen_pool_free(ndtest_pool, __dma, size);
-	if (buf)
-		vfree(buf);
+	vfree(buf);
 	kfree(res);
 
 	return NULL;