diff mbox series

[v2,13/83] app/test-pmd: remove unnecessary NULL checks

Message ID 20220124174719.14417-14-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove unnecessary null checks | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 5:46 p.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test-pmd/cmd_flex_item.c | 3 +--
 app/test-pmd/cmdline.c       | 3 +--
 app/test-pmd/testpmd.c       | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/app/test-pmd/cmd_flex_item.c b/app/test-pmd/cmd_flex_item.c
index 908bcb3f47f8..9050825a81d7 100644
--- a/app/test-pmd/cmd_flex_item.c
+++ b/app/test-pmd/cmd_flex_item.c
@@ -364,8 +364,7 @@  flex_item_create(portid_t port_id, uint16_t flex_id, const char *filename)
 		       flow_error.message ? flow_error.message : "");
 	}
 out:
-	if (fp)
-		free(fp);
+	free(fp);
 }
 
 #else /* RTE_HAS_JANSSON */
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index e626b1c7d9ee..298a594e709b 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -14696,8 +14696,7 @@  cmd_ddp_info_parsed(
 
 	ret = 0;
 no_print_return:
-	if (proto)
-		free(proto);
+	free(proto);
 #endif
 	if (ret == -ENOTSUP)
 		fprintf(stderr, "Function not supported in PMD\n");
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6c387bde84e5..31efa0fe61e5 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -902,8 +902,7 @@  create_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, struct extmem_param *param,
 
 	return 0;
 fail:
-	if (iovas)
-		free(iovas);
+	free(iovas);
 	if (addr)
 		munmap(addr, mem_sz);