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 0452045C7A; Tue, 12 Nov 2024 18:38:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF4FB4060F; Tue, 12 Nov 2024 18:38:47 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id DB7EF402B9 for ; Tue, 12 Nov 2024 18:38:45 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-720be27db74so4515730b3a.1 for ; Tue, 12 Nov 2024 09:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731433125; x=1732037925; darn=dpdk.org; 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=ycb6b65Fli9g74O6rjPtfVPspjz0tX8lkH+f9mqVs7g=; b=yUWYBPm9XZrWH2Og95o4ogu1VmvC33VWL3wK4/7dwgdR1x4qNMrAFl8c21mGU5wWgT hhGHi+c9oLbd2gxVHarXd3GVCiDaK6ke0zDZz3UHFp2jYPIdRT+0sU9OZ+z/pUIZfgK/ qi6mAPd3WgOp7+pGohNjs16V97k85WVjdssBYztKC8oouIDo3VvhXQ2oZiD44rcwwjEB zuoKRLPP5Xwww9O0q5XiWGeu47j/N0vwqdMNM149acXIv2+g+EjKGQQRXD9TyDVel7en HctVEs8yYdWFF7fRwMM8ueOh1zdDEJhSigD9/VZdmvDIcAvcl2QllSqKXTuse5kOzmn8 pGpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731433125; x=1732037925; 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=ycb6b65Fli9g74O6rjPtfVPspjz0tX8lkH+f9mqVs7g=; b=g5MLUIpTjj0p3DJ/A1+iP4/TKrnN3DZ22khxsp/8WDuaJS5jpXcFaBxEGJOeCt0PIT 9ina571AzgpLTdu6+SVSFzMRleoq/r40iH7WvwY7WfFdsNxwiFLE7UE8bM5ju1Zmyk3/ A92iXjzKlol51hx4f9rDHNFUdpc74nIHlJgbN3kYti38nVKmDFq0ndQzNhRn1cqCiC0a UO5lSJ4HxhQ63oeV64abz6zfcq3BAZTaiN4jwxR4eRFFJemSkPV15I61+w00zVhFjl0q 1UjXl9Gfggnkoa/U6JTW8Hb3Oeun0qWHkpp5GUkeYDVdtbInBsRNvVR0ODCtlHD2gZKt y41w== X-Gm-Message-State: AOJu0YzpUtJ/FQ2ncHAl4p3NWiuPCdSFL/ir49/obwsPw+YbestYqFtU R7W646zzTCDTLTnnuf8ra9+jXGBLpdhR2ODh/T+ImH0XNJzbwiMI4haEBEsfdJpix5PA5ze4Qi/ Chm0= X-Google-Smtp-Source: AGHT+IEmUBSC2lNUN/nXtnFr56G0+mTt6IXPCBIwf0Nqq37VMQY8KHcZ3GjqvMdQHwgGdb9o6LXbqg== X-Received: by 2002:a05:6a00:1701:b0:71e:6a57:7288 with SMTP id d2e1a72fcca58-72413f80258mr27164935b3a.5.1731433125008; Tue, 12 Nov 2024 09:38:45 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078641a2sm11836727b3a.20.2024.11.12.09.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2024 09:38:44 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , sachin.saxena@oss.nxp.com, Hemant Agrawal , Sachin Saxena Subject: [PATCH 2/3] net/dpaa2: remove unnecessary check for null before rte_free Date: Tue, 12 Nov 2024 09:38:02 -0800 Message-ID: <20241112173833.323934-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241112173833.323934-1-stephen@networkplumber.org> References: <20241112173833.323934-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 Calling rte_free() with NULL parameter is allowed. Found by nullfree.cocci Fixes: 5964d36a2904 ("net/dpaa2: release port upon close") Cc: sachin.saxena@oss.nxp.com Signed-off-by: Stephen Hemminger --- drivers/net/dpaa2/dpaa2_ethdev.c | 3 +-- drivers/net/dpaa2/dpaa2_flow.c | 27 +++++++++------------------ drivers/net/dpaa2/dpaa2_mux.c | 6 ++---- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 8cbe481fb5..a9bce854c3 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1401,8 +1401,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev) for (i = 0; i < MAX_TCS; i++) rte_free(priv->extract.tc_extract_param[i]); - if (priv->extract.qos_extract_param) - rte_free(priv->extract.qos_extract_param); + rte_free(priv->extract.qos_extract_param); DPAA2_PMD_INFO("%s: netdev deleted", dev->data->name); return 0; diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index de850ae0cf..c94eb51ba5 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -4784,8 +4784,7 @@ dpaa2_generic_flow_set(struct dpaa2_dev_flow *flow, } } - if (dpaa2_pattern) - rte_free(dpaa2_pattern); + rte_free(dpaa2_pattern); return ret; } @@ -5057,14 +5056,10 @@ dpaa2_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, creation_error: if (flow) { - if (flow->qos_key_addr) - rte_free(flow->qos_key_addr); - if (flow->qos_mask_addr) - rte_free(flow->qos_mask_addr); - if (flow->fs_key_addr) - rte_free(flow->fs_key_addr); - if (flow->fs_mask_addr) - rte_free(flow->fs_mask_addr); + rte_free(flow->qos_key_addr); + rte_free(flow->qos_mask_addr); + rte_free(flow->fs_key_addr); + rte_free(flow->fs_mask_addr); rte_free(flow); } priv->curr = NULL; @@ -5128,14 +5123,10 @@ dpaa2_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *_flow, } LIST_REMOVE(flow, next); - if (flow->qos_key_addr) - rte_free(flow->qos_key_addr); - if (flow->qos_mask_addr) - rte_free(flow->qos_mask_addr); - if (flow->fs_key_addr) - rte_free(flow->fs_key_addr); - if (flow->fs_mask_addr) - rte_free(flow->fs_mask_addr); + rte_free(flow->qos_key_addr); + rte_free(flow->qos_mask_addr); + rte_free(flow->fs_key_addr); + rte_free(flow->fs_mask_addr); /* Now free the flow */ rte_free(flow); diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index e9d48a81a8..2f124313fa 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -329,10 +329,8 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, } creation_error: - if (key_cfg_va) - rte_free(key_cfg_va); - if (key_va) - rte_free(key_va); + rte_free(key_cfg_va); + rte_free(key_va); return ret; } -- 2.45.2