From patchwork Mon Jan 24 17:46:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 106413 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 1CD2FA04AD; Mon, 24 Jan 2022 18:52:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C916542940; Mon, 24 Jan 2022 18:48:25 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id 359954292C for ; Mon, 24 Jan 2022 18:48:23 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id l16so17144598pjl.4 for ; Mon, 24 Jan 2022 09:48:23 -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=kegOLYze++Xnm+zOpzwGCtqkwOqKgTQ0qLsVr01AXRs=; b=ON8comOMQMgQf4s+532IvVnvsXrd+W9mu2lVWop4augJIs3eSrEkGid+33mmpPEuul wBeriMNpX0YlpGSXim6G/vhPSZPwl1gbz8bttBS/rqhM+DC0kyAa6r6ekh32YdaZp/bV ZfPrguZYh6+B3FwA/yxJijq0a6wpvU1FkHJwOQhXgioPWJPfUiKGEEmzkhkjINtvtwex 8p/eMKdKGanGmxpCzSSmDKp4DFzrmu/0rwgiRhFCI6aKGQEUxmQqZ43E/4SaS6Lu7api uDrK/uxc4HSDVc4HYwHL0OC1PICcii/Ia/AVqnZq0mp3WcgX/WjfMVr3Jdsi9fw2jzXI krcQ== 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=kegOLYze++Xnm+zOpzwGCtqkwOqKgTQ0qLsVr01AXRs=; b=vdBNk0u5zWVAxjUytAF0dC4PaY5xMRRs2+PNVmfHNVf10NinvYTk1f3Uvn5VdRLXt1 LdjgtLQs1/lOiqRX7ZezeJkHSUbyJLUlwNmS6aQuW1xVdLeRT4PaucjcrLhS+Vauu/HJ JPICRcM832U8jDv3Zsn3kOdTwlOPtSzvN+QzymHcsldnDa+glQDw+m2ZFXLFAe90k/oA aLQIqPckEzihPjX2vOcl3mnWCZe2U87QlPSFYr57Gikh1XcJP/5ruiPUX9lOOLbBrEGv H3gMAp9/V5g9LEtiXVBjHucZ1cOCxDWtN86++DwesOkMbfidJbLbXstob3hnuZkJMA/1 Ya1A== X-Gm-Message-State: AOAM530TYdw6w/NH2niq9PaPWVxtvJA28vXuLk7yEumhH7pCIbTyMPiK +g281tXR3enijJ7lqxNfNTXPPOJXugNHOw== X-Google-Smtp-Source: ABdhPJyln6OG7t8vh5k4dInQ+Fn/Ndqqwn7+neu6ZAHALAl3g05vy8diSWCmXus/g482WIGYS+WcKw== X-Received: by 2002:a17:902:e8c9:b0:149:b88d:5980 with SMTP id v9-20020a170902e8c900b00149b88d5980mr15175818plg.171.1643046502273; Mon, 24 Jan 2022 09:48:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:48:21 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Haiyue Wang Subject: [PATCH v2 55/83] net/ixgbe: remove unnecessary NULL checks Date: Mon, 24 Jan 2022 09:46:51 -0800 Message-Id: <20220124174719.14417-56-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 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 Acked-by: Haiyue Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 12 ++++-------- drivers/net/ixgbe/ixgbe_rxtx.c | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c8f0460440c0..d7efe5c6d753 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1322,10 +1322,8 @@ static int ixgbe_fdir_filter_uninit(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_FDIR_INFO(eth_dev->data->dev_private); struct ixgbe_fdir_filter *fdir_filter; - if (fdir_info->hash_map) - rte_free(fdir_info->hash_map); - if (fdir_info->hash_handle) - rte_hash_free(fdir_info->hash_handle); + rte_free(fdir_info->hash_map); + rte_hash_free(fdir_info->hash_handle); while ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) { TAILQ_REMOVE(&fdir_info->fdir_list, @@ -1343,10 +1341,8 @@ static int ixgbe_l2_tn_filter_uninit(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_L2_TN_INFO(eth_dev->data->dev_private); struct ixgbe_l2_tn_filter *l2_tn_filter; - if (l2_tn_info->hash_map) - rte_free(l2_tn_info->hash_map); - if (l2_tn_info->hash_handle) - rte_hash_free(l2_tn_info->hash_handle); + rte_free(l2_tn_info->hash_map); + rte_hash_free(l2_tn_info->hash_handle); while ((l2_tn_filter = TAILQ_FIRST(&l2_tn_info->l2_tn_list))) { TAILQ_REMOVE(&l2_tn_info->l2_tn_list, diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 99e928a2a971..9e8ea366a506 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2983,8 +2983,7 @@ ixgbe_reset_rx_queue(struct ixgbe_adapter *adapter, struct ixgbe_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;