From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C30DA04A6; Mon, 24 Jan 2022 01:11:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 54FC94290F; Mon, 24 Jan 2022 01:06:33 +0100 (CET) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id 9468B4289A for ; Mon, 24 Jan 2022 01:06:28 +0100 (CET) Received: by mail-pf1-f173.google.com with SMTP id n32so5132864pfv.11 for ; Sun, 23 Jan 2022 16:06:28 -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=lx2bqkBQ3SPk3ET4LLPF+ZmKB1ZAk6/Mtv2wfAKRtr0=; b=44DVBZB5LVDZNSKsTLSzHlDITBiE8wjbkTYKrxJNevLoL+NXFjn+QAfH3pwslMiHCM x2pBrB/ARraH5vJsPNBF7FMoesGlV0xytelzlOu2P4hG9A6A8kY3SO8URwxOCashj/Fn QYvdXNZ/aE1k3c27FRT53F4qMtnbZIguaqh2FOAA7DKhIqAIn/L7MR+pZHlyZcHKdpeV DZU2MbCUa/RM+LI0HU+K4tMPNA0yP9+V7pVTJhfsT12Vz06IQ2Jq2Wck1SnYkMuitH0d PrzLXmcmsqV9bsYktO8nY9j5lWPW3I7nrVQ5r2w/LEJO877GeAHqtOPG8yDJDsovOGu9 0aNg== 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=lx2bqkBQ3SPk3ET4LLPF+ZmKB1ZAk6/Mtv2wfAKRtr0=; b=Q/trLopJx3QpDy0Mb8XL6ggo1bLgOhgG0PkKMyCpzATiTUn+vziLhWhnsbAW3LUXVm pe/ovOMMvNqxi0Z+TZ9JPubLv05y9Aa1QvQwqYxeiANiyUYlF5NHcScLULOJBO1j8TEz 2lNxjFtdkOS4Jhq2ivt6svZqzK23C28b/H5KglF9IbZZ8tRhNZ3jQfiqMEZjWjvI4fI0 vGcrOBxpRmavEXoiYv5jlgYts6e1z/lo5JHROMNFnIOc89jx3nWEOGAjM8FwynS8H/Ut MVEujlAIik8spsjkUql0JwHp3aV90UCrGPA8aUxAZQbw4tIGb0UP6RliG6wyZngcCaDh f7jA== X-Gm-Message-State: AOAM53018jgU2decLBdDUlJ045T2creznVFto0CKNyf3H+sFptfJcUPB qejgkBtfzjgjxaWzEfdn4jwQ2WgYPdcxzA== X-Google-Smtp-Source: ABdhPJzSerGZJMjMBUpS71SUdjTkBSDvVaZde8bNl7RKuGpNaD7YjqI1bjPcn//krLiHGfHDviaZgw== X-Received: by 2002:a63:6906:: with SMTP id e6mr9978883pgc.170.1642982787437; Sun, 23 Jan 2022 16:06:27 -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.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 16:06:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jasvinder Singh , Cristian Dumitrescu Subject: [PATCH 63/82] net/softnic: remove unnecessary NULL checks Date: Sun, 23 Jan 2022 16:04:59 -0800 Message-Id: <20220124000518.319850-64-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 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 --- drivers/net/softnic/rte_eth_softnic_cli.c | 12 ++++-------- drivers/net/softnic/rte_eth_softnic_cryptodev.c | 6 ++---- drivers/net/softnic/rte_eth_softnic_thread.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index b04e78c6e0af..7acbeecae7a2 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -4482,10 +4482,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) @@ -4494,10 +4492,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/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c index 9a7d006f1a09..e4754055e90b 100644 --- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c +++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c @@ -159,10 +159,8 @@ softnic_cryptodev_create(struct pmd_internals *p, 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/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c index a8c26a5b2377..1b3b3c33c175 100644 --- a/drivers/net/softnic/rte_eth_softnic_thread.c +++ b/drivers/net/softnic/rte_eth_softnic_thread.c @@ -29,11 +29,9 @@ softnic_thread_free(struct pmd_internals *softnic) struct softnic_thread *t = &softnic->thread[i]; /* 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); } } -- 2.30.2