[1/2] app/test: remove unnecessary null check before free

Message ID 20230804164156.118331-1-stephen@networkplumber.org (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series [1/2] app/test: remove unnecessary null check before free |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Aug. 4, 2023, 4:41 p.m. UTC
  No need to check for NULL pointer before calling these functions
Found by cocci/nullfree.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_cryptodev_asym.c  | 3 +--
 app/test/test_reassembly_perf.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index 0ef2642fdd2b..c43a063b8262 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -565,8 +565,7 @@  ut_teardown_asym(void)
 
 	if (self->sess != NULL)
 		rte_cryptodev_asym_session_free(dev_id, self->sess);
-	if (self->op != NULL)
-		rte_crypto_op_free(self->op);
+	rte_crypto_op_free(self->op);
 	self->sess = NULL;
 	self->op = NULL;
 	self->result_op = NULL;
diff --git a/app/test/test_reassembly_perf.c b/app/test/test_reassembly_perf.c
index c11b65291fec..3af104b67348 100644
--- a/app/test/test_reassembly_perf.c
+++ b/app/test/test_reassembly_perf.c
@@ -81,8 +81,7 @@  reassembly_test_teardown(void)
 	if (frag_tbl != NULL)
 		rte_ip_frag_table_destroy(frag_tbl);
 
-	if (pkt_pool != NULL)
-		rte_mempool_free(pkt_pool);
+	rte_mempool_free(pkt_pool);
 }
 
 static void