From patchwork Wed May 1 12:56:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 793868 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2041.outbound.protection.outlook.com [40.107.13.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6E1F1EA84; Wed, 1 May 2024 12:50:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567804; cv=fail; b=ENPlDDpJ7vqJTbhzs9lgI7Pu+1iTVtnGC0cLS7no7Cbq2Ke/Ijw41cnFSx4NyYuXiCppjhEW73b7V9r7mN71aPrd9TMDP7a3XR8xDOsGlZpBZxRQeVOF3PyEP2fzgLP1NiypQFBdOuYER6/7eGPh72aa0rrIVEb3RCBpT7vSZT4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567804; c=relaxed/simple; bh=8+3VXwLUrYD3nDfOr7HntPuhh41zJEyci3faFCn1b9g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ZKPorfMwkw/QXH0MmqK8z3w9BXt15W9GNKDwcuj6lEKDbsINB/H3D1XEm5oeBE4Ok3AlwwzxuupJME9SeahbP8/KfoqTzY6it45RY2uFl8UU8RnXz4QKCKkGxNnbrvl5MvulN5TMXgGaLzlSvN5kpOzwu8sGwESKlVLKIiu8qn0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=mP2fBb9I; arc=fail smtp.client-ip=40.107.13.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="mP2fBb9I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lhv1eTm7xvunKW9nrQbYUw6o64/7RgXliZ2QCHTS2bxKvyHLwGFdX8dPqYPu1CDauO46kyGkV2lBJExChqWL+4+PAak0QMpvgTnwWB8AFNItcVpNEB8aDVq9mU8s5PLmUhxTpKWe4MWkf/T+Qy6Uz+QDfqQPC8v4QdklsHoPaQj2HPzl3EiC3GtD+WsKnayB2P+KLLyaPq4pPpGJvwWWWroYVH6fSe4Kld0KBPzn61688C0sZ7mFY9N4Wj3JafYW8RuOyoYUqoMJPa1z/DkQ4RdIajWMAq8dalZJlmmGNQ+9L+0rWt21ifKfGSYZBglaCAHlYHFxymjUGEyrMrlWrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Wlbn/xB/PZwPV7ROj5DqSEALVDss+DndXNnPfNwAESg=; b=kB1mwpdK6vW/OhPu1g5ZbbKKvNxrjbcs55N4d+z5FtBYh9KUvOI9mjriAdo9Skj/jBM38nlr+Sn3qSlGX7nkKcksYEwDb4znJEMUlraiUbLiFCIzWhxB5mO4XVeq8p674RX/Gki01hBCd/Byo+qrXszWHM46QPFjT/MwhZfjWzWKmYTA38Nvr1yeNFsrJ6BBVYkAmDUVpI7Hjc9YyW2Jtg7tlsn0lbIoM7jZcmR7M6quIFev291wVv7HH8LIpBoN9rOSsyfzripn54xlFpTxULydO7al2z7R5FHt0PmBBzBl5IBaVkRayXn/ikKDBhqQYxpuYHIwyut8M1fg3kZDCA== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wlbn/xB/PZwPV7ROj5DqSEALVDss+DndXNnPfNwAESg=; b=mP2fBb9II0l3GeKaliashAz8NJejLF3MK/r6w9BzUaDj/X7zXYHKb9x7HauCtaXpmfJo4FZbTXSn7gjfjmn9uRwzxSaQkiNJEtqxirHEfdcLS0A014uAFHK3GXynGnojTaoEziZLFfs8+i77ybXaQH37okheUM/Xg4Y9+IgXUS8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:49:59 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:49:59 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:04 +0800 Subject: [PATCH 06/21] pinctrl: sprd: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-6-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=1540; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=BMqLHOrX8EQjg9Z3uUGPLv8QrQVTIzjrj8QOQ3y5znM=; b=uzJS94q3JPQHLA5Dfym/hBeiB+V5HFBQEhABQJBlklJZsJPGzVQEg5YpRg/g13KZh31C77PmN EFur8rCNveRAK/bhsPtw3a3Fbhh+KOPCez1GBrD/0yhQsXLFPZg8lzr X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 13bd78cd-48a6-4e37-ac13-08dc69dd35f2 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OnqtqR8vLs4FBneMNgR4jcfKkFz4uNe?= =?utf-8?q?AkMhIoRnUC4GWmY5GFW0ByjTYZ+fkYbBokuyO0YMNT/6A9KkYG53yikYVAJWfupxQ?= =?utf-8?q?eGPMhVxg2j5Bq7rA0zdjvcnUb/xcIoiElq2NQEjz5Kj+tKyTns3DjE7R2lUxDAmay?= =?utf-8?q?7Mp8mpr2ahTWZ+sv+8hjPzh5Q046FA/aRd+a+20JetkDjMzKj5futSncW5bLpwA8/?= =?utf-8?q?7ZgCrpfxCKxYkdMl3RbBAaiTNfvgHnz+nJSrT3F26m0fZXvwHs/Rxfdsu70PuOZzR?= =?utf-8?q?s1EPujYNYrC/mIeo9vAVJ2aD0UyFffDlbzOlpic56vCQQFM+ESq764atz2IXmAD77?= =?utf-8?q?EIRkK+WopaA/talzPsWObPLos629jSQo1V5xBjLFTt1oQNmEXY7OncMyYciZVg6Wv?= =?utf-8?q?96oGq5ei8CUg5r4egAU8/u09THxaceK/g0wC7N58jXr6lrcqfo7ZuNYPDMiQfXh1/?= =?utf-8?q?7bRobp/tTuHjg31vV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RY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?MrYGaGW1Lf9TiwBBpYkbNlAmwnQ4?= =?utf-8?q?ftJdJQ7lWtCmW6jK9T5vJb5tGhs4Qy5FAuP2LthqOS45MEltwMgd1Vs6yVEgMmVFJ?= =?utf-8?q?cee2IY7PiY2WeFsBjlTIyieME/QOoeeLK+mtmANRrT2dD99CrxF4u9ynuHG6n3Pji?= =?utf-8?q?PwhIOPmtUdMb211PsJKmv5KCQYOW4EhkeXb14SPx5fQOpS0KbDXphdI5Fgz5IrR8N?= =?utf-8?q?dDNPdCijMjFjIu9YEwSiIa3owIdMWLf7lnE8wSnjAK50+6EQnnN6G72MoNv1DiSvo?= =?utf-8?q?efxMqg47sRJvWgoWzIQubaHudFSNwq9v5Cb9jhwarFD4h6INO9ci6Al5oY04VkBi1?= =?utf-8?q?9ETzWBSxNnwLRTAJWlZIrPmPeFLsj3dPCU22NFcdA66nVoaRV6CKCyIr1ZPr0MbTA?= =?utf-8?q?UHqOtw65+YZiq2czGv2Xjyrx+cn6sEo5TY0y0g4vSG5Tk2+UD0okg6ZHatohkqGp7?= =?utf-8?q?4mzr155wkiMSRhaC0vFs+URwAqUMve4vJcQVP3wpQXZrrDSwGRhfj4U1duhlYFReo?= =?utf-8?q?wDN7j2IDC/eIXt2pSjpreUENU502bP657JbLOvG3/l3wzD3/gD67JqBZybpjbxq9x?= =?utf-8?q?TkK/HqHHmlM8GwmLYaABmBw35T4AnTeM5nQpRcia5FAHSACBs1Q0n4dXjMRgWzRip?= =?utf-8?q?HoNiulzDGMAB1oI+S2lANtQRXXrf8OCnnN6jWxiuXok42kt+tNBi8at5t9KISudHH?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d78cd-48a6-4e37-ac13-08dc69dd35f2 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:59.4572 (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: HQwUUTKPiQihfGdhaJ3Zux5//CziSv+w5sPrXRinOo0DZZHN5lFE9uUBlB+TKIp6YSfoLdBBKWRlLQOu//Ngug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/sprd/pinctrl-sprd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index d0b6d3e655a2..c4a1d99dfed0 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -934,7 +934,6 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl) { struct sprd_pinctrl_soc_info *info = sprd_pctl->info; struct device_node *np = sprd_pctl->dev->of_node; - struct device_node *child, *sub_child; struct sprd_pin_group *grp; const char **temp; int ret; @@ -962,25 +961,20 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl) temp = info->grp_names; grp = info->groups; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = sprd_pinctrl_parse_groups(child, sprd_pctl, grp); - if (ret) { - of_node_put(child); + if (ret) return ret; - } *temp++ = grp->name; grp++; if (of_get_child_count(child) > 0) { - for_each_child_of_node(child, sub_child) { + for_each_child_of_node_scoped(child, sub_child) { ret = sprd_pinctrl_parse_groups(sub_child, sprd_pctl, grp); - if (ret) { - of_node_put(sub_child); - of_node_put(child); + if (ret) return ret; - } *temp++ = grp->name; grp++;