From patchwork Wed May 1 12:56:13 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: 1930193 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=QjwVmU/P; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-tegra+bounces-2082-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (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 4VTxmc5kkyz1ymc for ; Wed, 1 May 2024 22:52:32 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B20E11C2138F for ; Wed, 1 May 2024 12:52:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2232C12BEA0; Wed, 1 May 2024 12:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="QjwVmU/P" X-Original-To: linux-tegra@vger.kernel.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2048.outbound.protection.outlook.com [40.107.13.48]) (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 F0C688248B; Wed, 1 May 2024 12:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567949; cv=fail; b=K4/I7k/MDx/EqVWShZKaALnJOmVZC+Dne2LqdztdzupOEvF8RWEPxU3L7BlNtgAEhz230eOot9rKwUkhYVa4RQrzjdytaCFWUavM7CCu7uVe4+gE1qdr5j5ez5Pjj+XQ8rW7x8kTInj4e+SPirNfxtB2sjUzVtSSt+717mUFX/E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567949; c=relaxed/simple; bh=XjYcrC4knEYcZi59FiMv3CxGYKeUFr0HCFF+UrzXVqE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=C7CS/xyhVJdDIZGXwckRPg+xWeElFQ+tcBHTt1i15JA9jRNc8LtCs4xGzeAtMsloJXA6sqIDmkHh+wZCdkMDjGQcjx1Qc6v8D6faXFvzMjgZ5B+Y+isthRtEeVGBERtuG3DyoZhoWKKiTd6teL8iXLElVx8rgd6P8xGbGvdxHA8= 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=QjwVmU/P; arc=fail smtp.client-ip=40.107.13.48 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P5x4I8tO37vTuLowCXhJiaid8AwCOcoxxu/zGp4ZyrGMkxDO6AKX8SUWqory8nsXdpsFEwjGHClK4ZA1ENF1d7rDOcDdcaFWAPJAJRyMlqg0i5g8H+qUB1MB8Ro01CGB1N9RxBkZPemvk5N+nMcDNvUoOC1UtjVjwyhE3Y3CwUSlvw79VaSqUzaCnQ+c8Di3vWfeXupVbUkV7qIy9S7dMQxgh16qJK53j5Q4zu8DL4eINPaQoL5z7V1FUudYvmgXS0V5pC/zcXvFRWuzvcc3/6wvcpE+DInJsRtGhllw+dUGMBg+b4uaD0Z0M9jIgqVNgsai9u+ksdjIRPv+SX8kDg== 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=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=Qp7YW/KqOQ1dIuAeuLX9G9mKYCeQKb+ZdgY2Ckhc8HxmDCRJQAlOUzTPolmRrFTOOGn7PcIuVCLfG7U5S2ujSfjhRMzgPptAFeOt15NSFlhjoCMNWET5N6oBIBQQgiHUNdVLQ+dnrZakWh6sgp8vK5qajqhcr5Xv8uzpf79lqfHY4q4HZiaexfu2C1pLRWj3yB9zorFALQsIkeOTickhhqT2hKi2FnOqwgSgqO8dPNzeVlv6KFZCndCXS1nnNtGNXPx+UB1yC9EafPI6OegVC1pDkwATZrILcAqHwoMzz6Tt0YE1d5EGg9wCIk90WhAWwmlu1iHN0MRH+ttQV1NBFw== 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=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=QjwVmU/P+0pzdS0vwdoB/T96EuMtX/O3xazwcaD85Z/GcJaMJFO/o/vL1T8VCvSnot9UUwnYtXRBugi/l85OhU4qT8T4XznapKMfodEUiRpUhnLZVy5R3zk5Vzs0KAUchXBtiFzgERFIVIdrFy56HfHYX7thUjHtaig/wFaSuVU= 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:52:24 +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:52:24 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:13 +0800 Subject: [PATCH 15/21] pinctrl: s32cc: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-15-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=2925; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DE1TsODFhZuLZm6pDc3wReEJgqgWx9DxsgygoDyK3OE=; b=J8lSkR7Mx7ujJcqpDBCl4JEVNUPzdqXFCjkd8xS7+Ni7wVjQNgUYPHjNQ2ks4qlhJDcJuza8s sA8SFL9MSd7BbyS9zzyC4a0S11SP/gFWHH/lRxj4iR9+ll5Jb2h9ei8 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-tegra@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: a105c504-f42e-4153-e745-08dc69dd8c91 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?LElB/FPPZ9Xe/bpyL+ewsLdolpBFVCi?= =?utf-8?q?RWO4CSa6J4CCyVAzV1fFl6/jScwmncQU+b8eDBIdLk2rLuGKpA3Ma6TuQKVyVROYj?= =?utf-8?q?UX6Mj6/2pQsuAjAcdk/mmb1tw/jot95HLDzKFmj3QU0gWNMRpMGiLxzDbtzHmaakX?= =?utf-8?q?yleEOaCuBRSGe8S3J/g/5hAIK/bsUPW71gZ6+ipxjtAQ/yiYqwBRPcjxBEelDR60u?= =?utf-8?q?p0jopBcRqcGOzdZqX7VHFd4Udn/rdmypBZbeAA4EfBH5FN23k/lS2UvvJ+DhyYuwq?= =?utf-8?q?ruL76zkQDIwdo0kqTyUjcNhSPVnxYfjjLnXMBdJG0lRelJ9Ht2lvV7uARw+yTLpH0?= =?utf-8?q?19+/xYCtn7/7D6OZjH1XwMQz2fFlID/jjGcmO+eEjMgp7URjwgw53dsE5e/6pnW2A?= =?utf-8?q?REvSHvIg8gW0P2kApPMTxspgRyjBQDQSuQA0aeBxGB2eeYQ5kRnfRirP6q9tcfaAK?= =?utf-8?q?sLOfGNb+HmGCuhBgay6FoVJUUZMCxJi0KojWt6IXeQQzrKU64OeafvaFLV3bLjRzp?= =?utf-8?q?5cUDP6RNJk9XGgwiLTaR2CW0x1kTjtm4C6CY8GfMmOcpMhWSAlrNrTBfl74EdGXFW?= =?utf-8?q?FmIekV4lYFn/44utLlgTOGf9iGMEOCqm+LgT0OEgWQzC+G/DwwSOe1lLpUas4U7tO?= =?utf-8?q?M8st2iAJDeUDOTAV79wnP8nIpzIU6TamTwtSzSmM0y7c/3+rSUZwWww4kjlqIyf82?= =?utf-8?q?GAZicmj0GYWUuWQbV2I03Oy88b5iIWVMjnMr2aohN5FS4OAtwDSyZC/LNEdZM6U+i?= =?utf-8?q?0RMYDSiF591EO5Jhii123iuDmXydYAjDbzgfcIgC1TaLo/MlPhA50TvGDRlQtkQQr?= =?utf-8?q?eKpvG65CEn8AEvyMXkF7ppjr2f7Fnd38CWyTUYb2vLBr8/0kr2OXv6ug3dSw/xRMJ?= =?utf-8?q?7TIXP7lYaxtWnjrGsVwTPhKj6dTJkpmbK2MDGl7paEcJXEAljjnPTNOxUgO+xGUS1?= =?utf-8?q?Sbo8VUVzdtUIxMX9wWpBvD4SvX8XRhWG4y6pkG8Eu3UvGyFXpGBNltwwp1OKDAekn?= =?utf-8?q?q+PrfeK+QDHH+LTNXQ7wMQ1JrMgNNyuqmYNF7Dx4Ph9ILrHqbocIl9gNmfvb2DIGk?= =?utf-8?q?5CM29xCFMvIjfLiAAoakRQEig8Jdz1nHduBhE1OEcu599bc7kPXZE/MddDVPecBT7?= =?utf-8?q?1nQSYtRy32ouZT2ZPegIp/mkMH4+Y710ihODS85BvLbBgq4jSEc2gJAC2r86Csm/D?= =?utf-8?q?z4/KybfSk54R0Vl9VOhOlkqPhn2X9iH09+nQOTG7heScZ2y3pt6Og4VFvQaFpTWbc?= =?utf-8?q?mZKA7YWv/vESeaMBQDSDs/0XWpe8qkZXxM4dmReSEZEojKxrEaZOMa3U=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)(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?FjpB5mbza02i2T7amQTXNZjHJ3aB?= =?utf-8?q?eVeWY+T9qg6Gbjtnw4mfUhb1dSf8HAQoi4j47lZz6ERZJqk+qzMtOgtqudecDqxLE?= =?utf-8?q?x8/GH0O3X5s1TXxS8obsiO7WAW6YKGUYEGXHO/TGMw7jzYkG5/V9oZLze53H/a/Rj?= =?utf-8?q?Im4jJzxzEd4Z9x2XeUkANhyJkTTXewNVnzB+TdxJ5s3FqRaH7INZvyD5i/oNCtME+?= =?utf-8?q?Yy2JhDSVDdH+EuGtAzSM7iBuOX+9VXqPcZZqpa5MPF4P4WvfVJOs7eiDUqP5QcpZP?= =?utf-8?q?mtm5u9T5aQiPKnR4t8hZkllpURD6GtuO2LXQ/o0BtK3S3ES0kxGecHqPOHI1KRQRZ?= =?utf-8?q?ewlldlUgq8IELKx0slhOvCWNteNiUvjXWh19Ck/cQ+rfpwU4zIeAd8Vq8gUxpT8nm?= =?utf-8?q?IeIcZ229J47p3rOhCKIdivkrNqnOVjgqygC6eNnD1ip08Yix4tmizyWune6IjPlRI?= =?utf-8?q?6HFFqzTs+eBTeSlL/H5j2LJS/nZNgpGkjPusVXkUXn3TD3qj+QsREZ9H7JHBfNrkE?= =?utf-8?q?6gyKb3PS/uYuyMDfTCIKS/wciixBqr41uJB651PoyrGyMZTIxWMzvHv84f3rSJijM?= =?utf-8?q?D2An/gTKcMiU0uGDj2OAalPidhGdsmp1nFdWeJjfiCJ24ugBlSxNAE0eoLu507qLb?= =?utf-8?q?1DedyA980StjyPivSzrkIe4fyBqxzw6fZdJ+u59itfHissSGME71NDuUF19rgox/x?= =?utf-8?q?l+n1LyNStra2qtEC9uEJkTOrhwElc7U+/6Ok+4sDMHIJc1l29FjFvZH7WQEwDZsRp?= =?utf-8?q?T5/etWI6ySqVxHzsrg28zR1m1HPhdPZz9IeOyTLhTDM7A4177LW7QLiGiovP71ECx?= =?utf-8?q?m1nHVeyHsd1nDbWT7ElKE90sOKVNda4cS28+4E4V3fpu3oGmerVAKyyi6Qhgal82C?= =?utf-8?q?Y5bThdos8m74vQAGgwSf/HDxqfwRFnDwoXeTrd2CgYCLbA14q3XUkK4fJLrfvsekq?= =?utf-8?q?1S3Xz6MNsBcOPPshl/HyGcU1B63zBS/7tYvwbLo9N/cMDVZd8fVGblXTiMNvQTCoj?= =?utf-8?q?xgdSeaoVoAUHYx5oMQ+kn2cgV5xgn9+0vBgG+N1AL32aEtIQd9WGA/PBrFxk9o6tF?= =?utf-8?q?o/yye79l7Z+8M+7lVn6TFYvPJ8tGTnWGXIFPj2OiIwvnvuj+i6qbMT1q8peFz3Xrb?= =?utf-8?q?tAbrnwkxnOJRVUOsbnrVzXRJ8w3NCfxXRME4JOJx+KbkhWq7zm6WBlHfSIY6mrn3r?= =?utf-8?q?dc842CzkXXdOGYIlcZlph5zD3T+CC9K3KTM9NlNmtsVUm0EczYyQC+c7ggCnnUJ0F?= =?utf-8?q?p2jc5ze6Ol08ISKjrs6poax3/yyf51olNcWTo7/6C5h3XeKOfxgS7DyyW/ccdDXaR?= =?utf-8?q?qt5KH2GaS57PyrvLqVCzj+WG+PqGmrFfjHplMmWcvT6+r3ds5T3XkvXq2iw/7U5dY?= =?utf-8?q?Jd0qdRCNec84dtF06xO3zIEuxqYI8jNCbsY2CzSPjNdGV63fyLOE7fHN8yWVf2t+5?= =?utf-8?q?bM/h4TcS8eQIxJLqx1+448CuAT4Gz232AHlqxFQVotE0aIF40IZdQG3EVCCc9v+OR?= =?utf-8?q?rmYmPksMogL/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a105c504-f42e-4153-e745-08dc69dd8c91 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:52:24.8089 (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: CZStkNJGrOCQR6h70iowtdqpuRv0/HE6bewRFs5vat2TN7ogu87qOKaglGCwTHgwSua78d9w2wAeVmvCLtq+CQ== 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/nxp/pinctrl-s32cc.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index f0cad2c501f7..df3e5d82da4b 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -268,28 +268,23 @@ static int s32_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { unsigned int reserved_maps; - struct device_node *np; - int ret = 0; + int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_available_child_of_node(np_config, np) { + for_each_available_child_of_node_scoped(np_config, np) { ret = s32_dt_group_node_to_map(pctldev, np, map, &reserved_maps, num_maps, np_config->name); if (ret < 0) { - of_node_put(np); - break; + pinctrl_utils_free_map(pctldev, *map, *num_maps); + return ret; } } - if (ret) - pinctrl_utils_free_map(pctldev, *map, *num_maps); - - return ret; - + return 0; } static const struct pinctrl_ops s32_pctrl_ops = { @@ -786,7 +781,6 @@ static int s32_pinctrl_parse_functions(struct device_node *np, struct s32_pinctrl_soc_info *info, u32 index) { - struct device_node *child; struct pinfunction *func; struct s32_pin_group *grp; const char **groups; @@ -810,14 +804,12 @@ static int s32_pinctrl_parse_functions(struct device_node *np, if (!groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { groups[i] = child->name; grp = &info->groups[info->grp_index++]; ret = s32_pinctrl_parse_groups(child, grp, info); - if (ret) { - of_node_put(child); + if (ret) return ret; - } i++; } @@ -831,7 +823,6 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, { struct s32_pinctrl_soc_info *info = ipctl->info; struct device_node *np = pdev->dev.of_node; - struct device_node *child; struct resource *res; struct regmap *map; void __iomem *base; @@ -889,7 +880,7 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; info->ngroups = 0; - for_each_child_of_node(np, child) + for_each_child_of_node_scoped(np, child) info->ngroups += of_get_child_count(child); info->groups = devm_kcalloc(&pdev->dev, info->ngroups, @@ -898,12 +889,10 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = s32_pinctrl_parse_functions(child, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0;