From patchwork Sat May 4 13:20:09 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: 1974119 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=Q4Jz55xP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WnqL6407Gz1yXf for ; Tue, 20 Aug 2024 09:58:22 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WnqKJ00lNz7Bcx for ; Tue, 20 Aug 2024 09:57:40 +1000 (AEST) X-Original-To: linux-aspeed@lists.ozlabs.org Delivered-To: linux-aspeed@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=Q4Jz55xP; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=permerror (SPF Permanent Error: Void lookup limit of 2 exceeded) smtp.mailfrom=oss.nxp.com (client-ip=2a01:111:f403:2612::601; helo=eur05-am6-obe.outbound.protection.outlook.com; envelope-from=peng.fan@oss.nxp.com; receiver=lists.ozlabs.org) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::601]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VWp7x5z3Sz3cTh; Sat, 4 May 2024 23:15:41 +1000 (AEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hRU9oD+gCI8AllMgq87kzYL6LXgAyv72q3OQ/wuyed31OEyiMWOvAbbwCe2VDTrMGg7Z21zT+QvWhPpvyATZZMARpENnA7ZqepQTlF59zLf/X/5AKmsBTq7oII/9pZCf4A8a5FXe+t/s4ydIlnhtAALAj1ZAHuDhPyqevcT9D0pS/vhtA1V8oQA3nI4y8DXqMbQpAdIQG+bAmklpviHJtaa7JL+EFiUXCq6rnh1KlJCM+36n4EMM/PaMbLznoADLf3DD1Xm7VspxiWLIQN0tuesytE2bO6iUuPFugXeufpsK5ZfKDIj7HMeAoGtj6duSvp7FYuPxZXwYr0gR7HzuCg== 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=UOvnEs+skM9QGzIMn0U2l0iY/qhwIQjWYjJlD4x3FDU=; b=ZQtFwx3xBDkDdEM7F4IIc7StjJF8bribsUK4x97ROf6xfiiuumqN/lvIh7FUz8Iu59kbTzrkml1QsvEM6yerGPDt6zeKLxPxQJAmbjQ5N+fBGpw1Id6veuETaP3d58OA/cA/fAJrHAnl4RU3DPIUXJRBfURgNkL9hpwMKkrGTVxE11hHopj/LbpBrpzYRHU4kGoyR/QKTrwg3lJ3nIEF12N9WrPjS1tGVUHdBXs1v+AlZZB05s5XqqafSvAW0WsFMQlc/3x0Mg8RmvUOPQ0XfQrGYpvU5TLE/WoO5evD3aNPKGs/C4+Ce5jawr+/iu+J74MUNt5OOPmTIHNKkvaXaw== 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=UOvnEs+skM9QGzIMn0U2l0iY/qhwIQjWYjJlD4x3FDU=; b=Q4Jz55xPVklCOEhMsIghTu/K3ZsdV8zlhwWv8DIvis7TbOkzUaaeOjLpP4fFECNj86SLMjx1DeNL3Nk+SB2N0h7fVfvvayuYmpqAUl5oH567Kmet+LwjgGAEtCb5RJAh7fyYnmONkciEG6hEXyTcmCRq0yjWkgehl/QCgbrVwM4= 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:15:23 +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:15:23 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:09 +0800 Subject: [PATCH v2 11/20] pinctrl: at91: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-11-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 X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=2885; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=PFAUzME6mdXWvdeIt8xe3iTmfwle3TOSpNkHGUiPLOM=; b=ZSqBon2rMgrekfypu2BMfK1KhgN2I4TeLQnuA6cTenlBlAU32e6ztk3KfhwVMkDVeeE23HHUz fSXhosqCh2LAS4Z1TF9PJfbt7eER3+wURlcwJ8y4XASWKf8a+ucTYNC 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) 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: adcae72d-abe6-4074-1525-08dc6c3c41be 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?wgvjVL5y5x4TN2CT6l54X8gSECrqCEn?= =?utf-8?q?nNcPrdRNeP/omNeVQ3lhysId0T9PUgs1pIT6KbrF30SkEZgT+Go4Wuzq8c81ou110?= =?utf-8?q?wJC+uM8UuvcR4caTmR0geusa13Qnj9gGQzIvXELtBFeC5h3pcM2nnEFFomn6G8kEa?= =?utf-8?q?WQuqO25UzvpC5y/lhwloCXnlYvOmTA3503DCqkkzYitHRYj3kU7/l6+rxogzvgXKH?= =?utf-8?q?9RRwEXb/FiYGpJUp0qNDN4T/HhK1PeQjGp37LWapPzoBCOdXLnH4VryvhX2VszlX7?= =?utf-8?q?Zt6mN9sPeBjKxYn8BqB6s8QQt4brRFvH/xj1q2FFGPFR+0aYMqtxdtV1N1dO3eNXs?= =?utf-8?q?nXy0FIPM97ZMI4L3crlKNqyiNbaAdCl45xKe1yYXwE4ZLQ5oXS6TP4IYYE7GjaQzS?= =?utf-8?q?Odx2M9ISfndOobHUrw0GmFp2fKP8YAzeboQUovCZbqlMDJ82E2csgCcRoI6Sn0DY0?= =?utf-8?q?FPrfQsXIuTx2y6qlVseCB47Zb8JBpUwBt9dHlweiXpVrLgnQ/CW0fLSzsIMDtcR1u?= =?utf-8?q?PWBzVzyqWn/dj4WIqebMWa1Pl8UHlZ2qMoh5oaymYED4LY+JpBMOLpINSV4XWgGtM?= =?utf-8?q?mAEVVYAYVy3GrB76KRqpKyGwmFaS2+PqBktBZn/fvt+jBlhGJg5QV3Nt6G12HYKCR?= =?utf-8?q?nmzSk8PLCV1HddT0LDzbbNG1YcvHoIaNVx8rd3LN016GKkj46CvxFEYFGDJZ9upzO?= =?utf-8?q?o1kdL88IwOcvXOw/1SkgEXREiQSUxIkwGGfN+3+hkJ638Rgom9vHrG7p7l9JvnSaj?= =?utf-8?q?1t0k8f/g5KelaCA0WNP6WTWKi4GoKFFozj5dIpwKlJN5cPki7CyBFXxEOlLgz4L2F?= =?utf-8?q?slPcg1vsvjVuHp+FyXPT2VW8ykJkHHlAE+3/POWhV+9XysFliOune70eFWhFY3RT/?= =?utf-8?q?lAbn+iQrbC9rbdE8amA502pqOGOukU8iPNNQre04eGBAP+hj6iUJJsPpC2pjiWWXo?= =?utf-8?q?cr6mUFuleEB/01xX8ZRLkqdv4NN0rrP45CSZfadtUvP0hZ1qyZ8TlkYIjwoUV67+U?= =?utf-8?q?WFWO19PRpTfrnlaIu0uSWwVrUtKpLgT0TtaJGzo0Uv2s1KdIQKqZun7v2orX2kRGS?= =?utf-8?q?ZgpDGyenfeyAJXzsu34aCWuinSdvJvAOeNH1EC+Jcx163aFOM3Ik6nuirkBvqR1mx?= =?utf-8?q?1/h/U918CsJZKgpwNXHb2TyuCK62ce45SYK7Jndsi0M9UCjXIpSOCir85xBl/wiaL?= =?utf-8?q?K87hrM/HR7jJHOFo2gKCfywJZfiXPxOkWe0clBlq9oc4PEuYFhqwtuNQJuW+oXu9q?= =?utf-8?q?Uw45ljRVv2q/C+/Su/NAeNgSFXZ1D4SbbfRoC/28qHQUav1CRC/GCi+c=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;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?O5vFKnlozfuNA1A+gcpN8mzCyNwu?= =?utf-8?q?TPmUzYP1WW1YqdKdLuToReUj8vVk1VdJFrUvVOndvo8FW+p2/DYUC3LFdRJkPTzID?= =?utf-8?q?EvtIufhsknqO9t92li26b3MLeacjonqgdObY/tibdjq7ouHHueVZyNJAfqF5AXOnF?= =?utf-8?q?whPX3EkXu8PADB9S8M3Pbl3kI+E5N8iUW3idKlogNRivtdrzf8YoO0XM86fM2a7+C?= =?utf-8?q?IOLKXxfdopYi37Rg2Y6fTz5G0SuXPqLbgp3Q8IOWqS42OFy+VoFrGkBxXXV8fN9rK?= =?utf-8?q?EMID6X9qlCyBqn3323trA23ks9NW8nDMJOoBGiyJF4BCRpQGNwvYCxgBCmvcxK5K9?= =?utf-8?q?1UzXn4mPaEfGKvJOkBtXYr8dIl84l2AkWbQFx8KJzifXc10m0zX5pJZo701HJAK7r?= =?utf-8?q?32lggimz/Qfgsjrptzp6YLrzFOo/4aiHrB5R6BKQCgHCcWsRVo+hAgY1/uQsrwmmy?= =?utf-8?q?x/WknVbqLMk8s079G2WN+dPMtQte+CbZApaw7+RhrGlkTEZfVU1AyMLUxIIl1mD4G?= =?utf-8?q?np19f+E9SgRbxdTL+VCNENjU1s1f019VEAMgIck1s6WCWckcBYJA3nFODYbKZs55E?= =?utf-8?q?inJglOpxe5avLI2uYyZpbAQKAFCDlNWC9Zuvu7x8mf/zsXvydmUuXaYfk++/qxDBf?= =?utf-8?q?b+1NK2awXwxPx3f/qyr+uKA5HKlh8xH09Tjjn/IeXnJYZY4eswByZ89R3KujFwSJf?= =?utf-8?q?K9lq5DrOI+qT66eD/7NVPMJ0WHpnP1CWAFKG+JX16m9+RD2A5sgZowY4P5pBa4hob?= =?utf-8?q?z93HxfrZldY145lnVxZlGdLuclNdshgczy6LIWiguoVZWU+uvYbRcrdxianZp2IbL?= =?utf-8?q?VOUrr+teCZn9U5EQuihywLdhmWXCSxxKhRGzCTo3NXDq3gDyVQ0sl5RcZZaq1V7i5?= =?utf-8?q?c+MmL4bXgh8UJAjPbE8ZvPleRBJX0WwWTs1NLfy0BWO1PgRKqCOU6s+9NIcCfzOLz?= =?utf-8?q?9TcBa3u8g5huwfNhWws2IbGG6u5/L3Tftr8De4K9f5VgeXRXeJ5EPIbFOyW5SzYIC?= =?utf-8?q?I+tS6cklKfwLcnGUSE1/11Wu0oV1Esja2ZguMh7iEOGKXTmP/Aqo2IHxsjpAI0VhU?= =?utf-8?q?kJW2THR+yuFnicIXvJ5T/JicyH2Byx65zCfMySpUlUubvDA0dxwN1octryPHwIrDB?= =?utf-8?q?NJOmfqU+v7SuMLCvKXFBjDbJEtEHFeq4bHXckU1v3hkNYBTtjUKBh6Z2UopQTw3zJ?= =?utf-8?q?i/xMD8GUYyyGKeT8RVFpLQiWp2v4mu5Gto44BI8ncPYu7wZHyWiyPZ5X+xSFQHkj4?= =?utf-8?q?fXQV7DLYEMj1NeBebJugzaQDq64VlLMLq+KVVUUf8rkXftSVA8KrXFr/0mV0DVwmj?= =?utf-8?q?rfqIf3BhpYs4pX2Npb0CtoWueLWxtG7LBhqyYFOf7ieKPnc6tIQZVlbGBjai20SL3?= =?utf-8?q?0a9eSuKNvFuU+aDq7fNVqckRIzNHe+8orpMXbqda6X8bOQoQ8tn0WuIHnuJdisXHj?= =?utf-8?q?/ru0GQGp9g0LISPxN7LkvMf48f5RQv5FROcqWSpw2R2MSi0n8yo5vNmDwXu6KJgBA?= =?utf-8?q?CKRzrJkDD5gF?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: adcae72d-abe6-4074-1525-08dc6c3c41be 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:15:23.8049 (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: sfw12hIrvLjOgg5lbK8eknU3BCindbFYEf8fy2r3veI8lqSY9cN3GZHug0TMbaqAxJ3Pgh4eLG/BLrXZbhpy3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 X-Mailman-Approved-At: Tue, 20 Aug 2024 09:56:01 +1000 X-BeenThere: linux-aspeed@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux ASPEED SoC development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imx@lists.linux.dev, Peng Fan , linux-samsung-soc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-rockchip@lists.infradead.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Errors-To: linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linux-aspeed" From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-at91-pio4.c | 7 ++----- drivers/pinctrl/pinctrl-at91.c | 14 ++++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index a27c01fcbb47..8b01d312305a 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -632,7 +632,6 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned int *num_maps) { - struct device_node *np; unsigned int reserved_maps; int ret; @@ -648,13 +647,11 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, ret = atmel_pctl_dt_subnode_to_map(pctldev, np_config, map, &reserved_maps, num_maps); if (ret) { - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); - if (ret < 0) { - of_node_put(np); + if (ret < 0) break; - } } } diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 5aa9d5c533c6..b3c3f5fb2e2e 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -1244,7 +1244,6 @@ static int at91_pinctrl_parse_groups(struct device_node *np, static int at91_pinctrl_parse_functions(struct device_node *np, struct at91_pinctrl *info, u32 index) { - struct device_node *child; struct at91_pmx_func *func; struct at91_pin_group *grp; int ret; @@ -1267,14 +1266,12 @@ static int at91_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 = at91_pinctrl_parse_groups(child, grp, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; @@ -1296,7 +1293,6 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, int i, j, ngpio_chips_enabled = 0; uint32_t *tmp; struct device_node *np = dev->of_node; - struct device_node *child; if (!np) return -ENODEV; @@ -1349,14 +1345,12 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (of_device_is_compatible(child, gpio_compat)) continue; ret = at91_pinctrl_parse_functions(child, info, i++); - if (ret) { - of_node_put(child); + if (ret) return dev_err_probe(dev, ret, "failed to parse function\n"); - } } return 0;