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 81264A04AD; Mon, 24 Jan 2022 18:52:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C9B042920; Mon, 24 Jan 2022 18:48:21 +0100 (CET) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id 623C14290D for ; Mon, 24 Jan 2022 18:48:18 +0100 (CET) Received: by mail-pl1-f176.google.com with SMTP id x11so10534288plg.6 for ; Mon, 24 Jan 2022 09:48:18 -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=OUYCORe2vUmTo5U+aHVAc4mtCYCEHhtpbL/FAZv929Y=; b=pR0uSRjNnCE7I67VOzslu34RwLNeFeAOfvJKfSh1swOLnUHSH5biY14Id1qbe9u4tT N8ujmotK6DvSwuvMtVmLcTYmjCFseWg49JSNypX3YFCm0tqXEZSJDEn4busd+Lhozkdh vfMZz4fZ1iPE9FocuCfaQk0qzENhTMlicKiQ/l0cGGZdEWfFZfgQGrMSnbHN8YUZAwNO PBaNVEAVT/M8CfljJNDqrasv8uQZAFffW1h3kn/bWJ+Xz0mLn3TGX2solYpwMPADxbfu YRBIgxXc227k97KnfoTizWQfq5omXCV2MqlrERyt/A0GBkCyhSKHPk9dRr5+bdxBxwHr ps4g== 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=OUYCORe2vUmTo5U+aHVAc4mtCYCEHhtpbL/FAZv929Y=; b=swKxaMJkX0MMZaAWYswchKIFw9fdY49VqTkXv01E9dB272A157K2rCblPBhmXUXycN lwPpIQw7q4E7mYORNHACS3YA81diRj0v/K6kB0VtIXa1+PHEqGugYjkeU9ZAkkv7WDm7 /y55/nS0lckKjoWH/ZG3fJ3lsxJtR9Z127Byyl1FV/td3OlymJc/UwCrBVQQRR0hKNYH 9x85+Feo2VgACMSXT0uqxDCsbAhuRDPasIn9m2ACHBkWQtgt6tNNlzSuzak7JwNRRGSm z52yFTuRmvlKhJD8AVgbY2+fFg883Ep+gw5DOhBQqNH9npepO/ErjhI2g+2bZBJ5MtuE Qglw== X-Gm-Message-State: AOAM531Pcd2IaeFXAbRxW2FIzCmMCVqWVGOvasbLI7JTC3tDVBYpM/Pe qAtzN4tHwNfFtcnaaxEqiqHStE3GiQaMxQ== X-Google-Smtp-Source: ABdhPJzLbxSwJZzhlUGkIpZ+EZkfuSPjcN2e4+icuYgFyqommokaMuRYjNoEX9dUNrWL61/xqbAI+Q== X-Received: by 2002:a17:90b:4f84:: with SMTP id qe4mr3000824pjb.24.1643046497241; Mon, 24 Jan 2022 09:48:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:48:16 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Beilei Xing Subject: [PATCH v2 51/83] net/i40e: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:46:47 -0800 Message-Id: <20220124174719.14417-52-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/i40e/i40e_ethdev.c | 27 +++++++++------------------ drivers/net/i40e/i40e_rxtx.c | 3 +-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 1d417dbf8ad7..ecfa3c94db44 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1781,10 +1781,8 @@ i40e_rm_ethtype_filter_list(struct i40e_pf *pf) ethertype_rule = &pf->ethertype; /* Remove all ethertype filter rules and hash */ - if (ethertype_rule->hash_map) - rte_free(ethertype_rule->hash_map); - if (ethertype_rule->hash_table) - rte_hash_free(ethertype_rule->hash_table); + rte_free(ethertype_rule->hash_map); + rte_hash_free(ethertype_rule->hash_table); while ((p_ethertype = TAILQ_FIRST(ðertype_rule->ethertype_list))) { TAILQ_REMOVE(ðertype_rule->ethertype_list, @@ -1801,10 +1799,8 @@ i40e_rm_tunnel_filter_list(struct i40e_pf *pf) tunnel_rule = &pf->tunnel; /* Remove all tunnel director rules and hash */ - if (tunnel_rule->hash_map) - rte_free(tunnel_rule->hash_map); - if (tunnel_rule->hash_table) - rte_hash_free(tunnel_rule->hash_table); + rte_free(tunnel_rule->hash_map); + rte_hash_free(tunnel_rule->hash_table); while ((p_tunnel = TAILQ_FIRST(&tunnel_rule->tunnel_list))) { TAILQ_REMOVE(&tunnel_rule->tunnel_list, p_tunnel, rules); @@ -1833,16 +1829,11 @@ i40e_fdir_memory_cleanup(struct i40e_pf *pf) fdir_info = &pf->fdir; /* flow director memory cleanup */ - if (fdir_info->hash_map) - rte_free(fdir_info->hash_map); - if (fdir_info->hash_table) - rte_hash_free(fdir_info->hash_table); - if (fdir_info->fdir_flow_pool.bitmap) - rte_free(fdir_info->fdir_flow_pool.bitmap); - if (fdir_info->fdir_flow_pool.pool) - rte_free(fdir_info->fdir_flow_pool.pool); - if (fdir_info->fdir_filter_array) - rte_free(fdir_info->fdir_filter_array); + rte_free(fdir_info->hash_map); + rte_hash_free(fdir_info->hash_table); + rte_free(fdir_info->fdir_flow_pool.bitmap); + rte_free(fdir_info->fdir_flow_pool.pool); + rte_free(fdir_info->fdir_filter_array); } void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 9a00a9b71e2c..25a28ecea22c 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2573,8 +2573,7 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq) rxq->rx_tail = 0; rxq->nb_rx_hold = 0; - if (rxq->pkt_first_seg != NULL) - rte_pktmbuf_free(rxq->pkt_first_seg); + rte_pktmbuf_free(rxq->pkt_first_seg); rxq->pkt_first_seg = NULL; rxq->pkt_last_seg = NULL; -- 2.30.2