* [PATCH] ndtest: Remove NULL test before vfree
@ 2021-06-26 2:06 13145886936
0 siblings, 0 replies; 2+ messages in thread
From: 13145886936 @ 2021-06-26 2:06 UTC (permalink / raw)
To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny
Cc: nvdimm, linux-kernel, gushengxian, gushengxian
From: gushengxian <gushengxian@yulong.com>
This NULL test is redundant since vfree() checks for NULL.
Reported by Coccinelle.
Signed-off-by: gushengxian <13145886936@163.com>
Signed-off-by: gushengxian <gushengxian@yulong.com>
---
tools/testing/nvdimm/test/ndtest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 6862915f1fb0..b1025c08ba92 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -487,8 +487,8 @@ 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.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] ndtest: Remove NULL test before vfree
@ 2021-06-30 8:10 gushengxian
0 siblings, 0 replies; 2+ messages in thread
From: gushengxian @ 2021-06-30 8:10 UTC (permalink / raw)
To: dan.j.williams, vishal.l.verma, dave.jiang, ira.weiny
Cc: nvdimm, linux-kernel, gushengxian
From: gushengxian <gushengxian@yulong.com>
This NULL test is redundant since vfree() checks for NULL.
Reported by Coccinelle.
Signed-off-by: gushengxian <gushengxian@yulong.com>
---
tools/testing/nvdimm/test/ndtest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/nvdimm/test/ndtest.c b/tools/testing/nvdimm/test/ndtest.c
index 6862915f1fb0..b1025c08ba92 100644
--- a/tools/testing/nvdimm/test/ndtest.c
+++ b/tools/testing/nvdimm/test/ndtest.c
@@ -487,8 +487,8 @@ 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.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-30 8:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-26 2:06 [PATCH] ndtest: Remove NULL test before vfree 13145886936
2021-06-30 8:10 gushengxian
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).