From patchwork Wed May 1 12:56:02 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: 13650593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F887C4345F for ; Wed, 1 May 2024 12:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mJ0d9we1GdyzdQPbtJGUYQKFl02BDQY+vdSjSj3O0ic=; b=FBy1P+G16iaIzxEcV25gBJfXRz ryL54Awumz90DoK6GDJAfljbQWBhZCuCZzG4Sr4mRvHo+AYfZrCPkmCS6WbuoKS0tAeh0W4iKaedQ QyYz5AF3fKe5h2z3stFw7lMS45PUxuKFvvfSj27tIsjFR1R0hDJaxxas3SItfqa5m+X0Ib1LTQHg5 eGZ41slT4enex/yijwAGBQJnLChr5+INSGwvDEiGYxj8N9Cm+OUbhZ7836aOCM/zxbTMQqjJv0oYi zeRchTXHCJkn8iLmCcMUmctm6GMAwoUn8RkmKr1UdidDShHA14Ak0E+Zo6Fvl17FGSwV/LIPz5PeE TcCH2KQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29Ox-00000009Ycq-2Z1R; Wed, 01 May 2024 12:49:35 +0000 Received: from mail-db3eur04on0607.outbound.protection.outlook.com ([2a01:111:f400:fe0c::607] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29Ot-00000009YaG-3aKY; Wed, 01 May 2024 12:49:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cd2pkTEpxdjR4zHMJabEAK8ziMtPIJdXtnU2NZKH+0KI12XRklQK+DhQtJrRal59uhMEX9bifoohmvgy5x2EEFMBDYLWc0hreM2/HuKM6hipY4VHs1E5IuP69ZmbdMBk79aTnk43OT4jIiE8RnvutU6tvF8E7xIgMIFu3ISbNh3d2BLLA4gcmr4vSHF9NMRwF+ZP7Pi5hQU1iInfiojmpfDvkRnk8OglpS1yTeP6md24K9RxJ5U8S/Ljzs4qfLmDLU6qXyv+NyB3VmsJclpp+B5DFx4ngrVqzzvLvcsxlnfWODpBLAdlqTHHHUhLf02Y8ZevKWc9/xOmTOHFnk6zvw== 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=WgaCub/AVvrWstgRn7NDSa3uLOl1yukaIFVzxzPeW7I=; b=EhjlbkSwIpK9p5mi+T8IG4fJMmy3vM2r3qtAH+zO2GV6i1EIR0hj6DvE75r8/pNWdBh8M2gBbUvgvYvRxHqQFwETfJFXyr8NstOe3KlDaIwXGu7BQkNLDITjPC6PqUqqlIEhti7JjZLntybbY+B/96ft3UN3DhmT89ZbintLaW52oZuSNsmWfcOIwwIIL1vby/qgsy2AfbWbiEW1HCac3xC8BMKYhRFoNCqZn5E4ubYaJ0R8B0cFwqshVjIEXN2s4zLpOTI2X7rat+QyxUxL5s3o7fW/XS7Sa/6Q3zVjBeDIQ0pMir+I2ACkYrpmKHI1Gx7IYNX8RXkWZq0XezQ9Ng== 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=WgaCub/AVvrWstgRn7NDSa3uLOl1yukaIFVzxzPeW7I=; b=KqlxeudasMTvhe+KYjUqTRiD3zhIewnGUP/1/6FPzIUOiA7oIwOjMAYneE8FW/eXrC47IYOR5Id2saq1vXi4EVllT7bKTH9SciPp/WSRBpQEhmxx98G8kKyQ8xHo6utAnI+1zI/YiPCeNB4NpGnYXJgg1/3kf6F9AqjO0XWHZAo= 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 DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:49:27 +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:27 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:02 +0800 Subject: [PATCH 04/21] pinctrl: stm32: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-4-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=1839; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3dCftRoTOrOimvH/zZhm1znYYmC195eNUPhLJhk2Pd4=; b=fEVszNhFmB0ozWSgviQak9c62GVC/GEZgZAP4r8VCKSloHSeg9ffm1vWAQQ+bwWtefd5irQb/ 3aoJSkKQVp/AVh9+Sc4htbGVlXth84TcdldSRvPA3MnRCqG5c4wNNYL 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) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: c222aae5-b13c-4c9e-3bfc-08dc69dd22b9 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|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8EVjt68Liyl4MQHpZasE3WHwiLBPz9d?= =?utf-8?q?C6KvdEGa9xTBM2cCvlGl5yrvVkRdr3abjbOUCvbzTUl9U/3GcQjh9CYfVh6w+NYAf?= =?utf-8?q?wocG+mzeI31O411UQprlTPrrHsxDSFWEq7K4xo1NmqT+zVSfAKDJxAxdonCBrpd5P?= =?utf-8?q?PxMPsKzGBN+PqO2EfwsAK4FSKMVYfGHxecXsm+Y17zE7AbNemW93qJj4eSlauIZt1?= =?utf-8?q?R/MN+7KmAz4O/97HwOA09rniQAhasgV3ylarGYijtM++jHsA6tvPbZstZPsVoHBq2?= =?utf-8?q?VLPLHE5mtRfqr7YYkRWeF/6plSGIdTOO7WsuWaWUyrujQSoDk891k6U7EIthAYRjl?= =?utf-8?q?fut5gL/pxiO2u+J9zzzt/0qlF++D7xporJbaWnVH1pSb5pfvF/dedCm8U21tAr3aB?= =?utf-8?q?8+KHpoHVvA08oq/rHsGTn8PeAsAJ8TwA2jwCtdzEKwEtnv+4cALHRqppuLInQGx4o?= =?utf-8?q?LdBR9bWiWBhD6ZuR5Z+4DVgWNsTQJ0vLgwkXFCCmyPwNFc55ZD7xIbFsjUrTP6Iya?= =?utf-8?q?1nYevhz1+MEm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com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(52116005)(7416005)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6aA+8IVUEQmdvCPTyFKD9polhzx6?= =?utf-8?q?al7RN2yf/7WiOdGpoEIiRGak9CPqIrfj0DtQbiXbiHGrgXChBza9lF3tc41IsHosi?= =?utf-8?q?o4uoy5inABAj4N0F3gfbSRz0XR4+j/84hu6Sqt7XZWxzGDm7PHRJ5sRqlNtV56g6S?= =?utf-8?q?Q/hyBl69O5dXvz/NETAq0pFb8672wRj1noCtV5T6qF6Lxed4SXf2cTzjYx8+CWm5G?= =?utf-8?q?y9DJ2dxeWeNhtq4vi/rnVA1lhHXJ5DxjFH3ja4fwTRUplAgXlGbJJijbe85akHwSh?= =?utf-8?q?FSP9si4IMnY+P95gVD/HBYEAE2Ql0nT2xY29nCM0NHSdWao0Wakpxrs38HDmFmdEe?= =?utf-8?q?JTqMk9yYItQ17JZaduqfSDjkOa/SZnCbO1O7oMGbzLn9hc2MT+TqyUz4/etlFAG8r?= =?utf-8?q?amOpjQcq80hh5y636ziCKGxW91x5g5fWDViZ7h1HomPELTZtOqAr5kxytvSltUoUh?= =?utf-8?q?LcAKUl5LIfZJNCCU0WHqmE4PRRvjZc6rj76geb6sCAI7hSj/ZMlC2D6JsRWdRO4PN?= =?utf-8?q?Z8edsMWc/OLJhy/RFW7M7iweSjNTLVEZ0ag+AlPe6axz8jkoCPrlyhtmvaXePdvS0?= =?utf-8?q?vQ18tHwZviOTw3mfqcqEJy3weheydziIACHGByi8+8k+QfP6v3WUrNjH+TYAPcvF3?= =?utf-8?q?scEz4v6MAaQF47rUBsURefA2TNGene3wM6BwfZRQ+mdIKOdkniN2BgaOk05pQITC+?= =?utf-8?q?ArRftyvHeI+xZNQfibIoObbUhqR6f0IhHm4ELBs65A3uv14P14odZ+rGxwwSC1JvT?= =?utf-8?q?0KaXP/zxzDhCewZ+XpEw+q5/uKVw2p91evKg4xn96lbPKGnbKPygMqzHJsNMyeZc+?= =?utf-8?q?ITDS7p5BGjISiGNjMqhsCJOWxbuBIrD0mSvHNNyQ8toRxOA8JgOs70UiJNzJObtk4?= =?utf-8?q?+dJSjOetqQcngNo7ITSq8fe0jXDYK+tW8OvCMwNh2AbUyVoC6LYNxl1tzvvCu+ZQZ?= =?utf-8?q?afx3wUYDd0OguouO+sa5iNZ+7fooCP99XNpoS+hnXcs7uEVEupQuLrMpbG8tYPhcc?= =?utf-8?q?yhCsq5aYngjSBdBhGm83fdiUhpGOgrA2wR1B4yThH2UPVhB+gNZKnegzuU/8Qk7RU?= =?utf-8?q?crMv8LID2nQLv24pwP26X76/RR+EzaB65nEFycH5JBORefdTjPnxOZLz2LansCy0Y?= =?utf-8?q?Ym789OD31XnIyg8wX3Tv/Av6tW/Oi7/d9aAtSeLav77br104NFet9mZ3uK0nhCd98?= =?utf-8?q?6+rY+2VePT+4BSTw275Mzrh7FEqx/c4Y/bUcf8m1lFZCqAJuvrrlMqXo2WbTl3HWB?= =?utf-8?q?WTFofgOhKbzNVxtWyP2+NEfcckuzLcv8mNwsYaOYnBVaNznfiQ1fbbfqugTvUAwVA?= =?utf-8?q?zTTjywoqmO11FuemPBLSMn/Fut8YR+3dUhh/XXaLtqToIh/HbZ6X3X3XWSLmPbxX9?= =?utf-8?q?OkmXlQi20AfoAqCHKnSRcffBm98G/SolC2p8o7Pw0UARUlVNeyqomZ7v+9xo+YVv0?= =?utf-8?q?vcfV50N4r03HVn/3fMIDrcGzHB3Lv5mpEAXNGubTnQIXnwBthbqUnNSW26EE2r3dB?= =?utf-8?q?OQn0swugUaaQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c222aae5-b13c-4c9e-3bfc-08dc69dd22b9 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:27.2054 (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: gYhhvpfni11AYjiQmPbJI7VN9cJiU/58D8H2Bm9JL6Fv8mo+F82kEz2zeToWO4luMT6owRB/C7fRHw0IinuiLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_054932_071887_0C47703E X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/stm32/pinctrl-stm32.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 978ccdbaf3d3..ca163a91e724 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -670,7 +670,6 @@ static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np_config, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -678,12 +677,11 @@ static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = stm32_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } @@ -1401,7 +1399,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; struct irq_domain *domain; if (!of_property_present(np, "interrupt-parent")) @@ -1412,7 +1410,6 @@ static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pde return ERR_PTR(-ENXIO); domain = irq_find_host(parent); - of_node_put(parent); if (!domain) /* domain not registered yet */ return ERR_PTR(-EPROBE_DEFER);