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 87E52A04A6; Mon, 24 Jan 2022 01:09:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94554428BD; Mon, 24 Jan 2022 01:06:19 +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 ADBE842833 for ; Mon, 24 Jan 2022 01:06:14 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id e16so4334627pgn.4 for ; Sun, 23 Jan 2022 16:06:14 -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=YKeitL3n7s9DXaM3vIzdLgX9DQ5O+KIWTCxS9ttkgI9uWgzpl/N2Ekvqe8PQ0LwdTy DSKG7K0pAQ4sHfPU+x+63tauVreYUoi604FVf8rHtgtDDRTvOr1T99/ymz2Kat4QzRiH e54YkSdgkdOXnqCEzTbh6nNWIAREd27AXaRSsTMBWQbv+0a1ayh8M8xEFQqeZlzIe1Q+ 0+tIB5JEjY2D84ej+ZzSDyrbGtYtun4Gus9R3zrMgj8RpLKQ5La4iVo2SkFUyAAjZTym 3hDdTyLciaGCqQRz9m+EsCZOi7i+5XWEUsWG+r3EDCsZwmMDfXHEXakGXOEXxVboluUC ELhw== 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=GW5uOZFdMezagAYB8UodVlalrcC2AWSVZjyKNRgROpV5X8P8Zm1OZxxHZeEjZOHi3D jP/fvnEoGugHJhGpLktfi596CFQ/g33Q9YzrxhXPojet+0Fu3JSN27elj9YX87cM8qQR OfAfrO73Exb7B+/mtiHVS/yH1yvbP/owJKQftEJMS5lQwa1M7rm0s4O4jVrcEfGXzYhJ KEgYZkbun5sRz78NOVt+W1qflmcOuXiNvYS/A5URCMnEBPFs98AGK284S74hz1bAfjxV mWmUr2ifQsOGaJxLWgcoAhu5vzwfxi2jw7kgWJ1GyiXaDTYjAQhTyBf/I/m1PdcQQoEb 14Og== X-Gm-Message-State: AOAM5306LEfSa8vIwWMX0yw/QzzkzRbLbLdxMxeicYM8KdXZoxp5CAqU Y3iw63JjGkfC0jFq/LKoAUnRpRF/+JunDw== X-Google-Smtp-Source: ABdhPJzXL1ozizXd/i0WTHaWR/FUV67kqb+LrnIrrTBZP9M0O0VLfQPppIQaWDbBdknTlrhvqHvmVQ== X-Received: by 2002:a63:fb41:: with SMTP id w1mr3454820pgj.293.1642982773722; Sun, 23 Jan 2022 16:06:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 16:06:13 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Beilei Xing Subject: [PATCH 50/82] net/i40e: remove unnecessary NULL checks Date: Sun, 23 Jan 2022 16:04:46 -0800 Message-Id: <20220124000518.319850-51-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/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