diff mbox series

ndtest: NULL check before some freeing functions is not needed

Message ID 20210625071709.22440-1-13145886936@163.com (mailing list archive)
State New, archived
Headers show
Series ndtest: NULL check before some freeing functions is not needed | expand

Commit Message

gushengxian June 25, 2021, 7:17 a.m. UTC
From: gushengxian <gushengxian@yulong.com>

NULL check before some freeing functions is not needed.

Signed-off-by: gushengxian <gushengxian@yulong.com>
---
 tools/testing/nvdimm/test/ndtest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;