From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 93223A04A6;
	Mon, 24 Jan 2022 01:06:30 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id A6D65427F7;
	Mon, 24 Jan 2022 01:05:36 +0100 (CET)
Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com
 [209.85.215.169])
 by mails.dpdk.org (Postfix) with ESMTP id E33F5427EA
 for <dev@dpdk.org>; Mon, 24 Jan 2022 01:05:33 +0100 (CET)
Received: by mail-pg1-f169.google.com with SMTP id 133so13677210pgb.0
 for <dev@dpdk.org>; Sun, 23 Jan 2022 16:05:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=fSHQYaOQEm+SSuFf74z6AI2xRnXvYuH1R3TLe7EfB9M=;
 b=FL0VyfZtU3gQ6GSzWzM9xjSzMUSWj3Ms7HcvTFWO/HXsMustrKw6eNOQCHJzwUUNeT
 X+aoga8UrvHxlW2mJSWkuyL5Qh6Yo+vHHLBs8lF1f76gfpcbo24QMhahjRTNhzSY2Wgd
 ztXygxYD1WqSIWt0zNOyQNakk4Vvx8LogqtyiGUkDrSFA0qQPzdNLTRcI/s+A1KgtAi/
 nCUFa4pzJXY2TD0zugzYcRg7Z3B2EWq6mSUx7qEFygviJcjSVpDIg8Xz87yHB7Nr6h8J
 JpQTI/l8pM7IpRVpuoZOa+6MUVJFnQYJLoiHSpo+NBOFc3VawHdGnpePC+Q3YVm2PSax
 MM7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=fSHQYaOQEm+SSuFf74z6AI2xRnXvYuH1R3TLe7EfB9M=;
 b=3gGG4VZK++9HeRo+6+OR6c6/JZuDAjVYZrWmtprPnqxN/aTOvqa1AS34ZOUc+Z2QJR
 N0GX4AUDKBG8g3Z+kJ+Pz2h3wgRwtSsbnJ/mgy4qdnTe/6sWPH6ZSp/Buai7oA8sPXzK
 mFbU7tfigleiAUx/FNL69DaywF9Tq48sCBc9p6E+pwK4AnYDmw+jVs2oa61nibFHtKH6
 nM94pjDdQQTx1cWr1yfoNvVX+8W8ZmidSrQpb6wX0vh9n8EAgV7Vr3F2yycGCHtRYKlu
 +Xtn8/RyWdm8UeJToXSN/qjrhiDVg7GRiBvdvRzcHmvaH8xbQv1tq1CBXXvgqoc4FDNw
 x3eA==
X-Gm-Message-State: AOAM5319VdFTic1Ef0Ppsts/j1goRuvtgJJSBTTwqiPAy6cqup6odUES
 jurUQGhKZf/ZCkW90+HnHTnRVdL1rCJLSg==
X-Google-Smtp-Source: ABdhPJwt7078QlAZQ3Ni4hfkZVxbIfg8eHSledL7NBSYTvr7kyQwilUYJhHeP9hLifcnqK+d44jrhg==
X-Received: by 2002:a63:556:: with SMTP id 83mr1537724pgf.187.1642982732943;
 Sun, 23 Jan 2022 16:05:32 -0800 (PST)
Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199])
 by smtp.gmail.com with ESMTPSA id
 ck21sm10935350pjb.51.2022.01.23.16.05.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 23 Jan 2022 16:05:32 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Declan Doherty <declan.doherty@intel.com>,
 Ciara Power <ciara.power@intel.com>
Subject: [PATCH 11/82] app/test-crypto-perf: remove unnecessary NULL checks
Date: Sun, 23 Jan 2022 16:04:07 -0800
Message-Id: <20220124000518.319850-12-stephen@networkplumber.org>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20220124000518.319850-1-stephen@networkplumber.org>
References: <20220124000518.319850-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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(-)

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);
 	}
-- 
2.30.2