[PATCH 12/82] app/test-pmd: remove unnecessary NULL checks
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 01:04:08 CET 2022
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci
Signed-off-by: Stephen Hemminger <stephen at 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 --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);
--
2.30.2
More information about the dev
mailing list