From patchwork Mon Jan 24 00:04:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 106244 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 250B9A04A6; Mon, 24 Jan 2022 01:05:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 67669427CE; Mon, 24 Jan 2022 01:05:30 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id 94624427C0 for ; Mon, 24 Jan 2022 01:05:27 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id z131so2613283pgz.12 for ; Sun, 23 Jan 2022 16:05:27 -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=m9Fhm5t+AxyhwGNqtgJo7EQpKlSWzjNFbTcX1SJZ86I=; b=pLWv0c9sT2qNA+s3P88Lq9ExeY10VBr6Tw4THLP6o5Xw/9KZ+WnAmWSQhMx5m4dxUf oz2MpxjsrpGqVg/NeCIzzNoOkvPU61WxNg3HCXTMOvhYtAA7Pw2LysR0aaKxJlIIZ5YG D2SmCYSNztZ5BvZUZ6y75jVJgnvh4UoMjM7Zu+8idHHnKj4oobrc5AYLYDymLLnpg9xv pP/SqkdyGATWzKxhkpVXtg1IvctPnzwQCxP4MOhl8d5IHoqK7JS2HxiiNAqSwB/W7rZI BZHGF1XPqkFfAbAP8PXLcKn+OL4HDnVR5gHNxylYwEQOVvY75njDUWa9uk88XfGL6nGH OEZg== 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=m9Fhm5t+AxyhwGNqtgJo7EQpKlSWzjNFbTcX1SJZ86I=; b=DW9ilkrYWyqZU/c47c/xNwwxA4GIsv5JsNs1e+ZtFKoI1MsPhiWYPon55rQ5/Milax ayAOLPKY5kuWYvxtY8naz+BuissFBsCWC27WVRb/f/bDSePX2MjVT0Gh9LU3ymSVKt/i khXfByKiqsyWWEJUXwKp5kk0v/JhO/ODKm5ms/VLvGQoCrnSbZKAc08VEnR45uwrigU5 kvx4+VLv2iNFiDNBgV2AkGxZH6PZjD7b9etUWnvPg05bfSEKwN3jo1Z2QMsELNTZiDwa sEZfgPMs3Nct56GRTz292zAEcQFSCHV8edECvA4925epkpzxpPxforv3KQi1k4lcnR7+ 35Ow== X-Gm-Message-State: AOAM533t2IJSOxZbQ6gS3pCSOWoXaBbw+kzBGvK18GQocdM0eQGe6WBM WUJvJU57Zyta5MLSRAMhEaAW2/cCzOqd/g== X-Google-Smtp-Source: ABdhPJzzO5hjrtgxPHlLX0NiWDg9zmbeIE3FxvYFmIcnnMXEuo5iZnotc0992pESPieQU8YBKgN4oQ== X-Received: by 2002:a63:4e58:: with SMTP id o24mr9907609pgl.525.1642982726607; Sun, 23 Jan 2022 16:05:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 16:05:26 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Cristian Dumitrescu Subject: [PATCH 05/82] examples/ip_pipeline: remove unnecessary NULL checks Date: Sun, 23 Jan 2022 16:04:01 -0800 Message-Id: <20220124000518.319850-6-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 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove redundant NULL pointer checks before free functions found by nullfree.cocci Signed-off-by: Stephen Hemminger --- examples/ip_pipeline/cli.c | 12 ++++-------- examples/ip_pipeline/cryptodev.c | 6 ++---- examples/ip_pipeline/thread.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 0c372675a919..c918f30e06f3 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -3773,10 +3773,8 @@ parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p) switch (xform[i]->type) { case RTE_CRYPTO_SYM_XFORM_CIPHER: - if (p->cipher_auth.cipher_iv.val) - free(p->cipher_auth.cipher_iv.val); - if (p->cipher_auth.cipher_iv_update.val) - free(p->cipher_auth.cipher_iv_update.val); + free(p->cipher_auth.cipher_iv.val); + free(p->cipher_auth.cipher_iv_update.val); break; case RTE_CRYPTO_SYM_XFORM_AUTH: if (p->cipher_auth.auth_iv.val) @@ -3785,10 +3783,8 @@ parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p) free(p->cipher_auth.cipher_iv_update.val); break; case RTE_CRYPTO_SYM_XFORM_AEAD: - if (p->aead.iv.val) - free(p->aead.iv.val); - if (p->aead.aad.val) - free(p->aead.aad.val); + free(p->aead.iv.val); + free(p->aead.aad.val); break; default: continue; diff --git a/examples/ip_pipeline/cryptodev.c b/examples/ip_pipeline/cryptodev.c index 9997d974563f..cd0f9c3d4eac 100644 --- a/examples/ip_pipeline/cryptodev.c +++ b/examples/ip_pipeline/cryptodev.c @@ -151,10 +151,8 @@ cryptodev_create(const char *name, struct cryptodev_params *params) return cryptodev; error_exit: - if (cryptodev->mp_create) - rte_mempool_free(cryptodev->mp_create); - if (cryptodev->mp_init) - rte_mempool_free(cryptodev->mp_init); + rte_mempool_free(cryptodev->mp_create); + rte_mempool_free(cryptodev->mp_init); free(cryptodev); diff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c index b2e97327052f..82d5f87c384c 100644 --- a/examples/ip_pipeline/thread.c +++ b/examples/ip_pipeline/thread.c @@ -92,11 +92,9 @@ thread_free(void) continue; /* MSGQs */ - if (t->msgq_req) - rte_ring_free(t->msgq_req); + rte_ring_free(t->msgq_req); - if (t->msgq_rsp) - rte_ring_free(t->msgq_rsp); + rte_ring_free(t->msgq_rsp); } }