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 D2A03A0093; Thu, 10 Nov 2022 00:47:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73767410E7; Thu, 10 Nov 2022 00:46:58 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 63DFC40156 for ; Thu, 10 Nov 2022 00:46:56 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id c15-20020a17090a1d0f00b0021365864446so191591pjd.4 for ; Wed, 09 Nov 2022 15:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j5co4SVnDs+RMKfasJ46cav5do5uDqVp8PfISy2ngLc=; b=cUxEAUMSHfqKrKq5ViYWMKLtiIU6UzvR79owJcWdvH8Q8IUazIuSPQbeN998Vxsr17 DO9KhGuGyOxjdwFsMAf6/xeqouyKnS/C7SqpCyyV9thMqnZCO2239GkiA9KjmceGFwGf ZttdE/t0M3kco0FgwkdbQ11IwoWPJLOwY9FSTp4IACdwdZJTKOUOM237EN1/aC5ho1EK kVBjEX7RXf5qBr+DJGKABL4cLkQuHcirad8qeo3mmKULdsV+Ke4/PCKDo9x1XiBRnbJW E15/aVJiWEZ2hMDlzRWCDx1+AnfF5P54uXFAeMH+OLHcAA9lvct2+DRSEW0VjRFeGeFO k7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j5co4SVnDs+RMKfasJ46cav5do5uDqVp8PfISy2ngLc=; b=W2kRbRbjUO3UDr8tUnqaE1qS2J+PR9YZ3pnj/rlmuKf0ideIzvEy6VeWYEOlvJ7y5H lU1EucAjxwRP3jSFqYlZehP9etA/ujqFT9aoOOIThtKZOK643OC+BcLABXPOIVeicWbk D9cPlhPiIHhICPSy3Lx4tyBLiMxNFVPhVKleqofJT52w0qeKmdPxlbiOYOIAJDTFG1Jo IcWV82O3f771O83xEr/xv7psGPa6l9Dn6rH2DxQl68EbtaB0XHsWcl+LwwBY5WO983vn 73Kz4Bph3jFMQLV/LvADsh+ixcnz19bcIUsD07h9fRTIMklpKv2Wwis4RPPnHXWeEA7/ 289w== X-Gm-Message-State: ACrzQf3DY9O++NJ1vMZNYbPcfzBnZflV9UsBXRvEmS2eRZZ0IZfcRan/ BKP6D9C5XSD1F5D5WTIajd4X2YBkNY4WpA== X-Google-Smtp-Source: AMsMyM4WLTZEBByqw+C39aIUOLo6mMUBRvP507tzaaTFKQGcOJOTNVyGr30yy0G7YRty+/xafgai6w== X-Received: by 2002:a17:90a:d586:b0:213:de8f:4d6 with SMTP id v6-20020a17090ad58600b00213de8f04d6mr56551296pju.31.1668037615263; Wed, 09 Nov 2022 15:46:55 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id e18-20020a63e012000000b00470275c8d6dsm7895259pgh.10.2022.11.09.15.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 15:46:54 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 2/4] mlx5: remove unnecessary null checks Date: Wed, 9 Nov 2022 15:46:47 -0800 Message-Id: <20221109234649.331942-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109234649.331942-1-stephen@networkplumber.org> References: <20221109234649.331942-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 The function rte_free() already handles NULL argument; therefore the checks in this code are unnecessary. Signed-off-by: Stephen Hemminger --- drivers/net/mlx5/hws/mlx5dr_pool.c | 3 +-- drivers/net/mlx5/mlx5_flow_hw.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c index 2bfda5b4a5be..fdbd3d438d08 100644 --- a/drivers/net/mlx5/hws/mlx5dr_pool.c +++ b/drivers/net/mlx5/hws/mlx5dr_pool.c @@ -537,8 +537,7 @@ static void mlx5dr_onesize_element_db_uninit(struct mlx5dr_pool *pool) for (i = 0; i < MLX5DR_POOL_RESOURCE_ARR_SZ; i++) { elem = pool->db.element_manager->elements[i]; if (elem) { - if (elem->bitmap) - rte_free(elem->bitmap); + rte_free(elem->bitmap); simple_free(elem); pool->db.element_manager->elements[i] = NULL; } diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 2d275ad11127..bea7805ee267 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -7063,10 +7063,8 @@ flow_hw_configure(struct rte_eth_dev *dev, if (dr_ctx) claim_zero(mlx5dr_context_close(dr_ctx)); for (i = 0; i < nb_q_updated; i++) { - if (priv->hw_q[i].indir_iq) - rte_ring_free(priv->hw_q[i].indir_iq); - if (priv->hw_q[i].indir_cq) - rte_ring_free(priv->hw_q[i].indir_cq); + rte_ring_free(priv->hw_q[i].indir_iq); + rte_ring_free(priv->hw_q[i].indir_cq); } mlx5_free(priv->hw_q); priv->hw_q = NULL; -- 2.35.1