From patchwork Sat May 4 13:20:07 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: 13654008 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2080.outbound.protection.outlook.com [40.107.22.80]) (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 D9B4D2110F; Sat, 4 May 2024 13:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828496; cv=fail; b=mn6G9MkJvoNvVao/ObJXbMz4p171sMUYjGuzQ1iREquKkcLYnhIDQy1FAUZnCpPnlVkfP64d/QwWAFWq+CYl812PAGeHYUl82oN1SAKlqDTnXCTpLneO28gKUNtAPJ98IC9sSs8OwKSLPG5BLY3po47i75YEXoUcI7oQvA/zwD4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828496; c=relaxed/simple; bh=kj0ul2EuXMYF9cM0zyM/P5KHB6HNOsIcY8SnDh940O4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=GHm9QYqwPSIyp55m6Rq6b8QCsMlM+lrbULgimY0t0EDOCsvzCx0yHHvlGYB1AWzdFHHj646hFlHo6+tEI+u/KA7TK+BDxe0qjf4VpvaRZwqyCTGMvSCbaGxyW4jJPxVI8fnE5xkSGugefVFqvfMGwnz7ooHRRD+lAJOCG7bEHOA= 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=iZnIReQ4; arc=fail smtp.client-ip=40.107.22.80 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="iZnIReQ4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DUWsAuXgOKWq65PCrP9C+WmK/AFfmaCTCPRFukS/x2CYCw93S5laeahvxUYjKjd0pgj9JVyj13jj0RmcrgAeDgd70hzkOJvZRP5GhcDRrYpFJjHz+obdo016nNekOuqFcxx6UxlSPSiZNIZNaGzEfocf5gRCBx78gnlCx36a4eWUJaI+Ot9uu1xaOT/9xpAfI8t+UdlP0iyS1GFBCyaCq0cCMTuP5/AkW7dkEgdUmvMEzPkszbZg2wEtDc7d4jd6I0IoBa9OFDa4BlYBxwS2NGJ/i4s69gT7NPaRrSco1iijF3mim2quLCpJoqL4hbeGoUGu/r9Dhrx/atUdd0HAMQ== 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=vokkuqgxyY5IUH8pE/dXW6vgGGl21pxNgCW/XhD57MY=; b=hHqFpmyRqlcw/4fqhS5W/oGJyszBYWmHxskkNIVpi9ofFyxfnaST8RJiKVnILgnZICeZtTqjr3qOO2s+uWNPOZQABxDTUtBkDcbdYtH5nxrQ4RjH8wB8ELXTouK3bAr4MdqEM1dKh5JhoBUtQldJLA5zCkGHmLydoAPKh2rlcDMhzlfTrGsJ1+6USjrsFnSwiwwP57xQIL18wsgyO0NtaNDpqpGlzzg1xNerwUNEfycduFNSx+u+DEF7+VUS7JywZS+oTqtuZF3K6o4+YB3gIZdq5WcpKvkT4ve7BIg4gRCuYMw8XQhzJPQL73u4utmh4DkNNRTLymRP8vsEwcdAyQ== 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=vokkuqgxyY5IUH8pE/dXW6vgGGl21pxNgCW/XhD57MY=; b=iZnIReQ4wZWUttAX3CqmVOY/cy8r2jDJVTyW3auHbbvjzhM/6lPhBWaMzuaVvjFcMMkVEw5lp9xBPwQ8OOb3wIJ2V9Io5y7ggQD9n5Go8PmkJZp3PwpzGRW9H+kqj/OIZJHf4tJteLiUbW64KhA0qoTnqZq+37Lj+7it5wVTQTA= 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 AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:14:50 +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.7544.036; Sat, 4 May 2024 13:14:50 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:07 +0800 Subject: [PATCH v2 09/20] pinctrl: rockchip: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-9-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@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 , Tony Lindgren , Stephen Warren 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=1714828815; l=1826; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=8mEXPtWcMD1dO1kfLyDNpVkp869sIls+8yPccG0G3Io=; b=Khs2zelGliaL8fmUviQXPXSVDQ1eQ1SaAtwroqFPpigDdALV264pqy390e4AFEOqYQgGi9tW5 VAhx4S1rhRkBWvJ7B9Kn4+VsTHM/VeYcR3dExy9enWKyK+tvT3oIozz X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 6db9388f-6ac2-4d97-4849-08dc6c3c2db3 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|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0pH60V9008rbBWQrYiDgp+wjkZfqZ6q?= =?utf-8?q?ITDzL6K6zKPYWx68+opqbQ22O3iRddf7ALE9r6KWApbQT++LHfcBzaX7BPkHqVmQ5?= =?utf-8?q?1PcIZSC1KsOzCVHzda95lO8nk6fjA/1Td2rzEIBtlSpEM3JclFg/mc/s6jylz3dIb?= =?utf-8?q?18Ybe4LCss4ecRHt5/pvI19aNc60yGbUvJsaMJCW++CkYPTuEElbkf91pxHWyuF+o?= =?utf-8?q?PE0P5abtlakJ5yUOxm6zu2CogjEQYFLWFj5qhWe0eG9DHk/ltcdDPqTsqMEK/hh63?= =?utf-8?q?xPNZQPUMnzlCwo5BqQAeEIPh1UE04E1XtPuD6hPp2px6C/z1Vjczu1Lt0ECBoqJ/i?= =?utf-8?q?XtVWj35gvu7e11ml9olyUj4020T70KJlTBkqPIDE9sobeZBGaJsn5zSCXrpMU1BoZ?= =?utf-8?q?9el7UuuMwVUvnOzFZq1n53PaNwAW9kcYYa28aDAz5izhRAdwE3fF5AHTu8TYsO0eK?= =?ut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:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?36cOR1ddfY9XFDLY/I40iDDadd9N?= =?utf-8?q?HTRD46yBMj5UplVsaAIOjCO02mJoA/MD9I6WVBLWJ8YSOFnwM3ujrK9Ze6yYxELRT?= =?utf-8?q?kknye6VAP0wtvMxChcg8sqTHCGXVH0slL4WHV+Z3jkb7oocuP0i0kY+quU6bzAW5I?= =?utf-8?q?Vb0/K7CU8pfhYdUwdWOOEij1fGioEj6awqb0EfeX/TeP2f4uyJZwFL1FSHzY0UtF8?= =?utf-8?q?RhY86fDKLMZ7S6bsuLCPoylEKn075a2EMfrQsvBsC0rIfmH5c1eq1LsSK1F0okGex?= =?utf-8?q?4nmX43qiwyK2McxV0DJqzoSZ79QHdFYYRFThSh6vAYCXclOALru08XFfWERtlDkXQ?= =?utf-8?q?usO6A0OyD5P2U/4P9vVVMS9+yxWemJIxEp0hqqFQpTWtRNmgXgXIgq/vBEbpzf1Vj?= =?utf-8?q?DI9eqv/aN/XAG8yuOOhJZBzpYKhpOwVis5nvgZC34UrwLUM132GL//FURSDFE4UY6?= =?utf-8?q?Bd316NczQoajxmqdaEbmj7qqBU6olNm+XEbzNKQoV8Ersg5jIeF4uXBRVzXYQJFwH?= =?utf-8?q?IQIXa5naZAwjAUfOjZJ3AwlbtARDXRBqWpaAv/LBGmNFGOeabiziQQtc2YV9vGd+D?= =?utf-8?q?VHVyEHMV+madeR8tiXzV2StUzwPUsV1kUq8MGmn52PtyaImtFBJcW93eWejdOZGkU?= =?utf-8?q?pqaW2jkvKwQfOiAdXkGhCY9wKbhp1n2AwlGARFi7enIBlPUt7QwH3DW3ER6OnA9/F?= =?utf-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-4849-08dc6c3c2db3 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:14:50.1228 (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: k1FOWtQcbK2S5D56WJHSNhwKVTAFFg62e5/lh421anpq5APRIQxJEDcrzvxs6j37GpD2sPQQcQ4kMMkZMFL5wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-rockchip.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 3bedf36a0019..68391d6497c9 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -3057,7 +3057,6 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, u32 index) { struct device *dev = info->dev; - struct device_node *child; struct rockchip_pmx_func *func; struct rockchip_pin_group *grp; int ret; @@ -3078,14 +3077,12 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np, if (!func->groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { func->groups[i] = child->name; grp = &info->groups[grp_index++]; ret = rockchip_pinctrl_parse_groups(child, grp, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; @@ -3096,7 +3093,6 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct device_node *child; int ret; int i; @@ -3115,14 +3111,13 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (of_match_node(rockchip_bank_match, child)) continue; ret = rockchip_pinctrl_parse_functions(child, info, i++); if (ret) { dev_err(dev, "failed to parse function\n"); - of_node_put(child); return ret; } }