[v2,12/83] app/test-crypto-perf: remove unnecessary NULL checks

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

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>
Acked-by: Ciara Power <ciara.power@intel.com>
---
 app/test-crypto-perf/cperf_test_latency.c        | 3 +--
 app/test-crypto-perf/cperf_test_pmd_cyclecount.c | 9 +++------
 app/test-crypto-perf/cperf_test_throughput.c     | 3 +--
 app/test-crypto-perf/cperf_test_vector_parsing.c | 6 ++----
 app/test-crypto-perf/cperf_test_verify.c         | 3 +--
 5 files changed, 8 insertions(+), 16 deletions(-)
  

Patch

diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c
index ce49feaba9f3..4c7bc72eb5fd 100644
--- a/app/test-crypto-perf/cperf_test_latency.c
+++ b/app/test-crypto-perf/cperf_test_latency.c
@@ -49,8 +49,7 @@  cperf_latency_test_free(struct cperf_latency_ctx *ctx)
 			rte_cryptodev_sym_session_free(ctx->sess);
 		}
 
-		if (ctx->pool)
-			rte_mempool_free(ctx->pool);
+		rte_mempool_free(ctx->pool);
 
 		rte_free(ctx->res);
 		rte_free(ctx);
diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
index 5842f29d43e2..6b4d09e623eb 100644
--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
+++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c
@@ -79,14 +79,11 @@  cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx)
 		}
 	}
 
-	if (ctx->pool)
-		rte_mempool_free(ctx->pool);
+	rte_mempool_free(ctx->pool);
 
-	if (ctx->ops)
-		rte_free(ctx->ops);
+	rte_free(ctx->ops);
 
-	if (ctx->ops_processed)
-		rte_free(ctx->ops_processed);
+	rte_free(ctx->ops_processed);
 
 	rte_free(ctx);
 }
diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c
index 51512af2ad81..51fad5a05505 100644
--- a/app/test-crypto-perf/cperf_test_throughput.c
+++ b/app/test-crypto-perf/cperf_test_throughput.c
@@ -57,8 +57,7 @@  cperf_throughput_test_free(struct cperf_throughput_ctx *ctx)
 			rte_cryptodev_sym_session_free(ctx->sess);
 		}
 	}
-	if (ctx->pool)
-		rte_mempool_free(ctx->pool);
+	rte_mempool_free(ctx->pool);
 
 	rte_free(ctx);
 }
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 1e9dfcfff087..87f3a90055aa 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -551,10 +551,8 @@  parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
 err:
 	if (fp)
 		fclose(fp);
-	if (line)
-		free(line);
-	if (entry)
-		rte_free(entry);
+	free(line);
+	rte_free(entry);
 
 	return -1;
 }
diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c
index 496eb0de00f0..c031330afcfe 100644
--- a/app/test-crypto-perf/cperf_test_verify.c
+++ b/app/test-crypto-perf/cperf_test_verify.c
@@ -42,8 +42,7 @@  cperf_verify_test_free(struct cperf_verify_ctx *ctx)
 			rte_cryptodev_sym_session_free(ctx->sess);
 		}
 
-		if (ctx->pool)
-			rte_mempool_free(ctx->pool);
+		rte_mempool_free(ctx->pool);
 
 		rte_free(ctx);
 	}