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 C3B6845CA1; Wed, 13 Nov 2024 06:01:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A02E240E26; Wed, 13 Nov 2024 06:01:51 +0100 (CET) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2059.outbound.protection.outlook.com [40.107.241.59]) by mails.dpdk.org (Postfix) with ESMTP id 7879C400D6 for ; Wed, 13 Nov 2024 06:01:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tw3rm4MqlCluHRp2cc+JCKQITkielMOirxMWJjzH6uCyvZ2UN5gtdOtFkJBZHhe9F2LVx6cCwOX9SD18fQ0vm3yYS6djmgLmMq4mojhxhPZ6hP1/2RRYZW0fMnniz/A/IltKKA2GXJX42xbvh8I4Hdd8q0aCa404UcR3qaAFf829AoJffUcj+6kTnLDqOWpOHb1IlonGDjyA3IpRx3V4V0QndIBclvqMAr6FTulEo+txbFYvA9mhrUsHe1V6GFMIC859ZUKPDsz6QMuZP4TlS7N+7tE9HIT8ZS4CQ7JUqI8ooYaHLrtMdgQEvZxI9+y0AMNgygvYZz6+qFdGROFOkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=THq7+BCZu+M1JGdGsfybVD1lGUcHqq7fQUBS3bzcXr8=; b=PesfxvdD8Rlc9fkA5XWzpL0VawRnmHsi2GrjqPV+7uiL3wKKigPHV1DyLcg7Xs46/MFruQGWOnXVj4AYrZj3JQIAOHDhWPWrQYadmxJMN+tq70QLDbanNfQ3087ZFSrVNVEx6jrVKvll4bVHgY/Yha/zSUyhYalQriwYJ2AiIrABvpeSzTmnVawWjoyCIAKZlC3vL5UGS+apBOD1qHaR9TduQm6mFtla+sRcDMMO43IwmbC0kmwJDIzglgatayyoTtYlYMVTGgvmdAWvDBKKOHFvar/w3MhadxJ7L9gRb+ysyR74VB/xUhdZ/lcIWdx6OUSMSw7MjVNlMWu6pIM+8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=THq7+BCZu+M1JGdGsfybVD1lGUcHqq7fQUBS3bzcXr8=; b=iVexXQ6JgnmbcT17LJJZIzn0vRwrDuM993AxB/ow2AuxICMxS+nIK+tfAAQbQSTZW5zF+7zGT88/zDyopA6R2OywxwaffVeGPHB1Lh+lj1esSDFBUeyOb3iwg74r270XYTvmofRCRwF1lZslYiDdRymRWcmlVsDDCHQ0gs6TnJHNwyIx93XcCU16lD7ucehTSt0AKlC6/n9snhx7Y7zFl7KF2kagHvZRCN4reQ1zHc1XvB9U7FIV1ftUuc2axsJ5kmRoxeRM0Kw6WSoOwk7sfr0vcoak/ES7g9KebpnRQ2LaKhIiyUsq9L6tCcI6QGV9jn7OvKIBPpzKGEFHsZFRWw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by DBBPR04MB7610.eurprd04.prod.outlook.com (2603:10a6:10:1f6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Wed, 13 Nov 2024 05:01:47 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::367:d59:375:fb87%4]) with mapi id 15.20.8137.027; Wed, 13 Nov 2024 05:01:47 +0000 Message-ID: Date: Wed, 13 Nov 2024 10:31:43 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 2/3] net/dpaa2: remove unnecessary check for null before rte_free Content-Language: en-US To: Stephen Hemminger , dev@dpdk.org Cc: sachin.saxena@oss.nxp.com, Hemant Agrawal , Sachin Saxena References: <20241112173833.323934-1-stephen@networkplumber.org> <20241112173833.323934-3-stephen@networkplumber.org> From: Hemant Agrawal In-Reply-To: <20241112173833.323934-3-stephen@networkplumber.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR02CA0042.apcprd02.prod.outlook.com (2603:1096:3:18::30) To PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9328:EE_|DBBPR04MB7610:EE_ X-MS-Office365-Filtering-Correlation-Id: c33b15aa-d872-4f4f-1340-08dd03a046e6 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?U1I2TURpREU0dXNDb2p1RS92QTFKdHFFVmlWM1llTXBrdXRFUHN4UHFTZjVa?= =?utf-8?B?ZXJQT1R0L1ZqeHZkMjI0a1FRN08ySHlTc3lCdUsxYllhOEZDaXBUbGhjVElF?= =?utf-8?B?ZGYrc29hb3FmZD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094QmpCdVprTVNuVnVDR3g1NUV1aS9IQkJwN25LeTdJR2ZQbTZjZVY3ZEpH?= =?utf-8?B?YURLUnZVbjNzeklrVGs2dk51SloyYWdMb1hHMDV1Wkgveno1V0xMQ2FDNWlp?= =?utf-8?B?dHp5a05YcU9veWJCZk9QWlJnVlFWNFBLV2ZQZTVoZ2xwYkdtRGJpVDBWdlpR?= =?utf-8?B?R21qWGpITCtzMU1Ea2ZibVlTVXZTd2xuaVhQS3hkTSsyeHBoWkJJUHdjY28v?= =?utf-8?B?TmU2YWZPbnUxbjFYcUFQSTZGZWZZNnlrdTNhYmowSmdHUlNtL09sb01XRGVW?= =?utf-8?B?Rlg1dG9xV2NVQTBXbWpqMThUZzVlbHpoWWluTllvZDNJUk03QXpRT1BtbHQy?= =?utf-8?B?UkJpNjRtYkVIenBzMmEzcUxsaHBnbExBcUNKMmRvNTFhQk96QUpMaUtnSFBu?= =?utf-8?B?NTNyVXVQVXE3eGMzUGp1V05VeFU4cEg2anpJbUUrSWZWZ2R3QmZmV1o3Nk52?= =?utf-8?B?blVkbUlTS3VoNzJjUEpLVnNRb05ROXdZT0xNRjJDeG4zVi9SVEVwK2dnSGF6?= =?utf-8?B?NTB5RUdWajU5TXBxOWpCZTQ0TXVmWWRhSkRPZjFmT3RmcVpuK05CODRlR0l4?= =?utf-8?B?UzEyNEJxaVZSOXl3WHdrVlp4bHowWmZSaWhoeWlON3F4NEtabXpnWElyM3o4?= =?utf-8?B?SjV5eG5SaUVCRnpGZ2pmc1ZibG1XMXd3RTNsRkNyU1RIOU5JVFJCV2crYzVh?= =?utf-8?Q?rtI2JK3i8kQ0i2dQGaLnbtQ6KzdTQVBwCl29WW9?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-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RkJKOFVHQmZhWXdLL2pJ?= =?utf-8?B?c1pSS2JHODJncHdHd1ZKY1BlVnlrZ2NML1BsZkhzOUNlbVh5Qjk2ZFh4ZWo3?= =?utf-8?B?QU5qSGY5ZTVvblc1a2pjRFVZbWI2M0U1cEJzelBMN2xuQ2VMbzE5QjNPakVE?= =?utf-8?B?Qkxka3V0Q2lhVXkwcFVWK0FjcE5LTlVCckxVK1Z2alkxdDQrM1N2d09yVi92?= =?utf-8?B?LzlLcWN6WEtHNU1QRGlrWXdERUF4OTlwbnJBS1FZb3ZLUFpmZFVUTGdIR2tZ?= =?utf-8?B?U2UyY3FxNGdxeUlRdmRsK0dxOElNdGFzR2pKR3BsWVpNT3lrS2JISXZ0RkRZ?= =?utf-8?B?eWkwRm1Mc0JDSExRZldxR1RRcENiUFJRYUd0UFJ4emx0c1cweW5XYmhXRjdl?= =?utf-8?B?NitWUUNQSWFzc05PS1YyL2hPK1VaOEcySW5rSDhQVjg5NSt2d2x5R1YwOE5C?= =?utf-8?B?OVE9PQ==?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c33b15aa-d872-4f4f-1340-08dd03a046e6 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 05:01:47.8020 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l+IZlWA3uI5rfdftTvt9i/GGs2ZR8O8axaAOSRqJ15lBk5ATgXwSnU0xRF4Q3LzyqXBbJ5q9ml81gdT982R25Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7610 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 Acked-by: Hemant Agrawal On 12-11-2024 23:08, Stephen Hemminger wrote: > 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; > }