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 68C7EA04AD; Mon, 24 Jan 2022 18:53:12 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B3844296B; Mon, 24 Jan 2022 18:48:35 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id A5EA842960 for ; Mon, 24 Jan 2022 18:48:32 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id e9so16048510pgb.3 for ; Mon, 24 Jan 2022 09:48:32 -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=omHZXJ04mKWsg43e3BBg+A3Y3CxG4tXnDR6MDeQLu3+bfPvbYd8x8PdbUj6abR0tok ZEru+kZ7RZw7BlTc4bnTaIDavfV3zh0hsfAj9oYVrP0ABc6cw7x+1XENs5d8Cg6x2cUl SMrUQ21St0oJ363XXTgsobLIAK7VazFXbWS/6ibW4ff/t6HJo9lHDZSLuLHbIf7bknko aNUu9w9S9E9yML42E8Kxfj3Mnf/wD9zqSh6lj8XPp4x9Tz+3Twlryi1YBacpeN9l3YNQ Coe1Lk7x/0iTf1svgNGLHN38wysXXkhPRDMxPd7gM/1RJSDgt9yb5zmtCqLnLRWaCR8Q cG5A== 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=xcDqMvG1/6xyYufpNpWSJlYdO6xlHCLgmShd7NBaT2kQNMqflu2SAyY8N1NPfEGsZC VjXJeJzKu9rrakYw2kaWgqf9+TvEIEB1CNHcKOsFZZaHuVABYJRMBEl4iLM9ONIqCHPS G/x2odEjoAh+gqTbRRR5yqORT+6qhx9/l4O2IjmbYvNCyrIkiyRkBEh1wwBCsYUZFs2t fn+1Mp2423P0xbO0y/O6/vO/nTToisic42XiKeRfqO+aIfGSg2/y7M8YNiixtv1nbS5P yn8pGEC2kLFof48eAv3sEcspFbatCMWsWnUxeG6PyrjkPJLxNlcdpJt54XSPotKHa1K8 0e4Q== X-Gm-Message-State: AOAM5323rrGVlJIopZVdxeSDuScLVPhSClS0/Ioo6VNZHUwlslXQttWH 06LfcSxNicnKJm9rKf6ZwtHK8XXkPTUpDw== X-Google-Smtp-Source: ABdhPJyrtm0MwdDk42SBl4GQWqLu5G8CZLYWiNQz3fwktlPnEaJcrxn+ql+Dcoh7jWFwg3dYkMSr2Q== X-Received: by 2002:a05:6a00:2186:b0:4c6:50ea:6701 with SMTP id h6-20020a056a00218600b004c650ea6701mr14752204pfi.12.1643046511670; Mon, 24 Jan 2022 09:48:31 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q7sm15835082pfs.37.2022.01.24.09.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:48:31 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jasvinder Singh , Cristian Dumitrescu Subject: [PATCH v2 64/83] net/softnic: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:47:00 -0800 Message-Id: <20220124174719.14417-65-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124174719.14417-1-stephen@networkplumber.org> References: <20220124000518.319850-1-stephen@networkplumber.org> <20220124174719.14417-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