From patchwork Sat May 4 13:19:59 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: 13653960 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 766ACC4345F for ; Sat, 4 May 2024 13:12:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 5B2EFC4AF18; Sat, 4 May 2024 13:12:40 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2046.outbound.protection.outlook.com [40.107.249.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id CC97BC072AA; Sat, 4 May 2024 13:12:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org CC97BC072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UY7zlqxIQP4a0lCG19cd/h/eNk91MNW0MPe2ZEXbWeyKbOaQb3KGvf+59/GdrNKFsxHVxzxCb8V/Uf8FFYwBhH72xdJt3sChpofEmxkvAU0N9nkKXFTAiYKdKRFY/lDnzSv8apboekGYxPCa+idf62VEcif6Q6Sv40hsseNFLIsv6rz1I9ThFq/VLbo3jRCPyvocKVoVML/vKG8qI16hjeMHZi37KTC5SnTUsm8CUKCaVK21GYukGewBH3fWeKOxwrYaupy8yeZfm8Y4UQgxqB/Io5T2DLEk7APtUhnhlBi4ZeMMIkcTGwiBBZmVA7OLS/bhiHOELARH0HLvUgMqTA== 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=xnIztDwVNRck+xwGiauHd7SjHMFdl2QwKvaMCCPUiQU=; b=Cu6szOifWb8hjTpJcCl9o60zOxpU4DqihhS1IgLtrb8MeKVL61qmqkcltBXvJkxymIqirKaLM2HrK/740AOdGsNFKcxym0ykdWiuWjmz1HkRP1TeXAc8qdMsU+HYz2b7aKeNv1enyUAi2O5qXAir+uqujEdjcCqtC3eo7W4+PhvptLogY5BPAo3FuHHW/HXhSLlx9g6ZPcD9rYCqnS0W+g/7I3iTmAGj3648emQmGGz6xJ509iWd8qNkVCE7pQIskG35c1YYkLcEu5tgkz5BqNQzGbCU2QjKMkzDbM7yam4yc+fAvykWNg67LsrpXIbJr7EDf6+K0Lf+Tr299b2ieA== 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=xnIztDwVNRck+xwGiauHd7SjHMFdl2QwKvaMCCPUiQU=; b=RfoqmVxxKBchWsVMFsNGvdIgaX2urC6JZngbr5PBYllS2QiW+z2o7qS27p7FAN5YMpeaCiCi3gULtNf/zGv2vLc0YleCQvEoYO/xVFSZ3yKQb10r5mTJTEcprkBnZNntcov4lTcYOcRk6MmNLjbsHz86gh7c2WQZYn+bTsX1Qlg= 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 PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:12:36 +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:12:36 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:19:59 +0800 Subject: [PATCH v2 01/20] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-1-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=2712; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=+OvVNjQ9hEJHGX2TTZXWfIPqFH/ASaiGPFRoyyD86ck=; b=wBwz78+ulysi78J8qrvqUz4DHAoNLDZSQ8dx1MUycl0AKWDH3Hh6flSWohonDhSJYkPD4nSLU q4z3mqBYnq9AJZKYQSF9Qw0Mfn/LYZD8v5fhhR/sN5iLqcismO0zG9m 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a386a51-db17-41ce-fd86-08dc6c3bddc0 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|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ylrGjuIJPqlksyumulYTkv74lzsB2C3?= =?utf-8?q?3S4VRDdKL9cr9KBrtmUsYIQvkZwvsYIB7q0ZOt6/URJvAwM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/Rtr2iztNsy5vYXqZ3l5?= =?utf-8?q?5ZwYw09tifn2m64Knk05+8fqDJXWkSTsFSAGB5kA3OIRvpP6KjSzODgmAm9Pk8hfp?= =?utf-8?q?DzfqxOb+MqieU1jN+2OHoIBV69d8l7sOy6H+kN2OtjalvFkTdREocaSQSijNes3kn?= =?utf-8?q?b6F6SjxAo+dqixH06MDGUoGHlObfG8nrbFFgfvhPraXS6zk0NMvFXTv3kuEjG3/o5?= =?utf-8?q?qclS8rFrARc6msLCVSqgPTG/dVBDXDhrfVPpgTc7+onGchQHBHZ4h37ZF9vEp57yz?= =?utf-8?q?8IZjgQpv7pSuJGUgaBjujKGzCG5FX7aNOJYra4Uv6DJpBJLWrzUSrOxRUPCWSkUK2?= =?utf-8?q?TtL/wKGsfz9Ip5XwhKCowyvDiiu3/CsM72YdsgQa0QXYlwoOsbU5Prd0=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)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qUn6dpxX0MBL19yJgUlHqefCAk1O?= =?utf-8?q?kdM0fcnokGJfZiLC6CAtU+/2DQ/jtD99OhpqlP558rM67p+u99dBYJQ/tvPmmPG/x?= =?utf-8?q?tgCMrKwjkav7vryY6rVsrlOjelIqesrXSaQG4ttxZok5wjA3vatbQDqByvcYDC2O9?= =?utf-8?q?nFhsrZ8F2LjQJLEUA1FZncdxI7/S6FPOEMo14oZeYiOZ3Ci9W9XRa+sHMFSAlG97s?= =?utf-8?q?4+blNm2JFywVy+aD/D7Nlao1A8H+qQALbWf5XNMmne/E91ieGmCPcQjns8acFnHkC?= =?utf-8?q?fu70ZUudpFqNK3EWlCH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+E4tImRxH31IIJFJEJRe5E?= =?utf-8?q?5J7dQ5is/tBBpn9Obm8ca4OPJZDxrgDm67RhlzizNT5gTz4bNdRaVM9M1VAchuPSn?= =?utf-8?q?3oDJrbWUK53ZskCa2ehwthNveKeOmoFynOIGZ90bcOPhpo9fUo9Yj/HCRBDmNC0sL?= =?utf-8?q?RLeVs4cv2/aJiWQVCBkiMIHpxb7QMIO9nUgc+YgIL/bnFFZT9Hb6KRJsFjXSTMcxC?= =?utf-8?q?Kpg7zN6edDBnJBOOobvUlq2/sbJ7Fh9FMQsLL00M81IP5GI+yvzH5FMm07LR9cJY2?= =?utf-8?q?NPDTiizdiiGrKT7EwuEJnUlQ2SeVvZZb31rwHWoBtab5qzlCXNjOwZQCRd70hvzt7?= =?utf-8?q?jdJ8+uLghO/Y?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a386a51-db17-41ce-fd86-08dc6c3bddc0 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:12:35.9937 (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: xkL1NGtmjTHzgUEOEpGYD3XConoiQLgB8vnYFjSMgVN5FoD8qaklgWrmfeCEQ+h1dWwFnYe/mlK+tvyurvqy8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()") Signed-off-by: Peng Fan --- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c index 040f2c46a868..1032bc9c36aa 100644 --- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c @@ -822,53 +822,48 @@ MODULE_DEVICE_TABLE(of, ti_iodelay_of_match); static int ti_iodelay_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = of_node_get(dev->of_node); + struct device_node *np __free(device_node) = of_node_get(dev->of_node); struct resource *res; struct ti_iodelay_device *iod; - int ret = 0; + int ret; if (!np) { - ret = -EINVAL; dev_err(dev, "No OF node\n"); - goto exit_out; + return -EINVAL; } iod = devm_kzalloc(dev, sizeof(*iod), GFP_KERNEL); - if (!iod) { - ret = -ENOMEM; - goto exit_out; - } + if (!iod) + return -ENOMEM; + iod->dev = dev; iod->reg_data = device_get_match_data(dev); if (!iod->reg_data) { - ret = -EINVAL; dev_err(dev, "No DATA match\n"); - goto exit_out; + return -EINVAL; } /* So far We can assume there is only 1 bank of registers */ iod->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(iod->reg_base)) { - ret = PTR_ERR(iod->reg_base); - goto exit_out; - } + if (IS_ERR(iod->reg_base)) + return PTR_ERR(iod->reg_base); + iod->phys_base = res->start; iod->regmap = devm_regmap_init_mmio(dev, iod->reg_base, iod->reg_data->regmap_config); if (IS_ERR(iod->regmap)) { dev_err(dev, "Regmap MMIO init failed.\n"); - ret = PTR_ERR(iod->regmap); - goto exit_out; + return PTR_ERR(iod->regmap); } ret = ti_iodelay_pinconf_init_dev(iod); if (ret) - goto exit_out; + return ret; ret = ti_iodelay_alloc_pins(dev, iod, res->start); if (ret) - goto exit_out; + return ret; iod->desc.pctlops = &ti_iodelay_pinctrl_ops; /* no pinmux ops - we are pinconf */ @@ -879,16 +874,12 @@ static int ti_iodelay_probe(struct platform_device *pdev) ret = pinctrl_register_and_init(&iod->desc, dev, iod, &iod->pctl); if (ret) { dev_err(dev, "Failed to register pinctrl\n"); - goto exit_out; + return ret; } platform_set_drvdata(pdev, iod); return pinctrl_enable(iod->pctl); - -exit_out: - of_node_put(np); - return ret; } /** From patchwork Sat May 4 13:20:00 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: 13653961 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6DD03C10F1A for ; Sat, 4 May 2024 13:12:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 4CF00C32789; Sat, 4 May 2024 13:12:57 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2053.outbound.protection.outlook.com [40.107.249.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id D35B6C4AF14; Sat, 4 May 2024 13:12:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org D35B6C4AF14 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PsBZCp9Q2DoZaI+7hZlpN4AV3qyDi6yk7j7xxI7aGPT+2QAuqBU8BWUZRtyjv5ta58Tjp0X17Pj4FUsFIUhwx6616LxpbEML5R1Ge0fKCdWbw8EiidXONIprB2Xp01fjzqw20PD/0PwOIvndEJM96+EMEmTohkJ1lWum4EBeydMmKGozTV4yYBXpD5+8N9JKmqqkt7bbmuA0ZA5si/2/imZivs5R8QM/eyZf5o/7FJahC7Ymfg5h8X6hAcOHR7+YWkS0MBYx2zi0C9eorle4yqBpsSs8nmrYHAVjEjwPJmNjk5roVvDrL6UfzL/+YfLoASCQ4gI7MUA8tV55yPaq8g== 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=9XH/O68wWJ/FfHgYL+Kkys96wwEpB5Ik6VZZUTwb4Mw=; b=TWncYo9doring7vInD062OrPa8mLEYYPnQHCKdGMbQ4nwgay/lYItCeIzbuggHKlNeECzTvi9foYcxGeNknjR9IKymosX2iGWN8xXy73U3+Vu9K3QAQiGswibNii9Q+Nl4hSw08IndO6k0s9Op6HkrTJGjGDRKJQ+kZyhkic4EtI1aecDrvzQqv0Fb4bjZNBMkaGuyfL7i+MInmsqksnhJ3OvHNDCCSWhMVtfLv0/T5HM7BX5LNVZ+2yeTLknS21cBk39N0cqWvodUUDth9uBOxs+94yeIjQDuL8vdtdoGxjSDbkekeqyB4bs6/uNcq6ToVOHx3LjaWqiIvORVZd3A== 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=9XH/O68wWJ/FfHgYL+Kkys96wwEpB5Ik6VZZUTwb4Mw=; b=V349u3hIj3jx8cbwqgkcfFeYcAviXPW4lFmxDNc1jpRnCj3N2UqV3+1FNPMZisxIMljtshFftZvf9/CqPZF/gwdakXv3n++Lu4Sy9MydaP1a/VvfeQHrAQFT2+jWoV4WSZYvwvdlm+9h7N/D5atkTpy3EcMi0t+yX1XnvLDWNo8= 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 PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:12:52 +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:12:52 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:00 +0800 Subject: [PATCH v2 02/20] pinctrl: tegra: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-2-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1919; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=dgr9gEpDJDvikxHa9ZakH2O4ug/ULsl0qx1MCE8QJXg=; b=c29ur0xozBQHWw4UNa1DPvMPB/3nv84hzDNq2CwMxaS5GG6IYyoT0/JK1IrVkkQRteonbSNKJ JhK2UeiCgPTAeUzI40ur2LqqsCNKyNGdObHFdFgxDDw3tA05J72cW0s 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 567fafd5-b163-4390-58c8-08dc6c3be7cc 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|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yaBaAp0n/XaiCLVmNLKTzI47WLUIhnH?= =?utf-8?q?82QFvY4TwOsj8ejsIkl2uv8IlJjlK37Azd8ku+dn+YVbbKQfcC4CA77pA4YhgdxWO?= =?utf-8?q?tq/hdOuek4hBy0yupbJ/5rony8uB3hbpHUVLgSMGODjknbfBQYrMQHdOvUIFHKAjP?= =?utf-8?q?oi0fuM9M3IuJDwRnDfGpUWVZkA/dt4zFwcgdFZZObZ5mkIm/TxzHo55iuusoCxNU5?= =?utf-8?q?B7c8OIUVot/SPjWKzDPuOjg1Vy++0j9I+zZb1GGgE2UZuLaj+q1u5Onv94V7Zt+kq?= =?utf-8?q?VYaaOYcMkpnLmFqCzrN85R8KG5h0RCjXf0wXlSYod9wjM1VvDWUu/40vrBaq7hpKr?= =?utf-8?q?zgCL+J0hP21Dr/kRpGIX6zFWOg7HrqzTzWqMg4OVo1bXYHpneZWNWw/Zj0A3Z1YaV?= =?utf-8?q?rwoOLX/WTbm+kBNG1P4GM0i0FUw64t1k5OFs1QLNEgrcNk9zNMmXUTnvIf4pBm5j1?= =?utf-8?q?JfeP0LyDHP828SRrBHNj633QwXcHqCUfKoiv//syVWxRqSRH+n0qwtyCalFn7tHh/?= =?utf-8?q?1E1ggXpsNfVMhCBgPgZ1JLwlMSsjpY9CBxaBUYRWkL+T7h4XaAr0kWOPSO5RNQPy0?= =?utf-8?q?8hrTcNCrcDorvOMu9fxlf3ceZjR/I73m/JEpXXZsjUmF5FPlHqGOvYMCYKhuJ1rq/?= =?utf-8?q?73vEOh5wwGCUzF1eSDSCOgw+kTPcXRJEfDIw0e8e3og1kiBQUIHSYqjv0qbvF8zXw?= =?utf-8?q?2t261N1BF0sqhU558giIyatv7rwh0h/3SqbiCeGSb6r7qm1WHb8sjuYf80SWKF59+?= =?utf-8?q?2XVnAFLZpn2N0dExtHrkkJt3MFgJV2qmgF1jE/6VgNCSM+AVMPm46lNlkNvU/2QSP?= =?utf-8?q?C8QtO/2ZiTqrdaJFChGPPY0/O1i9rjG+18eeccKLmEAVnV/edaclceYZiVNNu6QRb?= =?utf-8?q?Me3y+5bnO1/uymWjn5XWfLnyosD762FYZXAH9PuvKjadCLVs4PBhfBky2ocWdJD0W?= =?utf-8?q?jLyOKlw8My+pbJuqxtqBmOvmRxdSy7lRJi0XGQ1a2oojmAybLkfM8DoXpEa93x5Nk?= =?utf-8?q?cksL+39v5NY47EZKQKwHXs6zosZtBu8++YSzWNG8SqkKOZWu8Igv8hk5zrkVVKLS6?= =?utf-8?q?9GmPStSO41AdU5Pg3C2/4ietsIeyTehl9YJujQbJ7TX+eskfFX+g/vHB94S+E58RE?= =?utf-8?q?eisqeL+xZsoJXXFWe90IBnDEUZoLgv9eLALn8+rY1VE6TCwj03Sne8bSo+Mrku37m?= =?utf-8?q?aWT5HUvB37YOd37UzmzgLtbUwTWj+vCcx2h+YoyeetGQF0ozP0bm8hJyveBSvupVr?= =?utf-8?q?4C3c8O0jpOhqK3yiHSwJz9zlJ2KTyW+xF7/VV/sgvG4n/64eu/1Yot4I=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)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kXuL4T/o0DiUaqT0OjhdOr8767Ig?= =?utf-8?q?MHS4D+c6Mlb+5Q3IBb0CRzPLJ762GdfmUOXnIMBAG297n6WWKA2vOpC3cjHq13CIg?= =?utf-8?q?7fl0mNqsKf4re9ei9eRfUQPTbsG7pP7dBg2fhogXee72OvckcabwCwK4PYLKHefLB?= =?utf-8?q?BSay6keQTPRqw0oA1ap8GwM6djgVanJ2ZN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Ut6YToLKPUYtNFTr8Nf1DoSh?= =?utf-8?q?0ZeJHrccq/RGA08BAcou2gQUwFGrNlJt9RMjqrK3lfxZiW8ldBxGhiUW2oTlcknSa?= =?utf-8?q?EC+/7VHq9HxOLVAIT4/qu+J1hsRl9+ykyensXxbdiDKsaGkaMembbZaer16kyTzYN?= =?utf-8?q?QEHDFgv87+dVnZCMBHYhLB9LmKXYGHPMuvkI3f9JUkKQHJF1f1tbUwQD2Ce5s4TH7?= =?utf-8?q?Bg8Bv17NCvQsz3mC2hBcVc7kSszS/o8kKSGDpbffcKeRgbE77YpBVpu1w1Ayahzks?= =?utf-8?q?rdday7qOSpju55nXlHwb2Gnu6aqmHUS2RumB+Hzs8nfKg6E02nxbSF4qlcjUElnVv?= =?utf-8?q?zr4R2AJlogiMGGEbQIe24w6lVVoU1O5AVErhaEeCSRFbsHDU6qH5/79DogbrY7sKY?= =?utf-8?q?KvVhH+bAM7dNqasFycZxmK7JKA0vfwUHvE+BY4SxedEbzCbiiQ18yHAQlzlKBuX+y?= =?utf-8?q?VMuGIUrVeoC+?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 567fafd5-b163-4390-58c8-08dc6c3be7cc 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:12:52.8610 (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: 4sy0/+akhGM1b/xMzo7AidLZmxf7iqXZJ2mOFSl12FWS2ISjCqiAQ+I1mwlX0irAQsix20v/1FTiNUyCDxWpQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Acked-by: Thierry Reding --- drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra.c | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c index 96ef57a7d385..49c5edeba87f 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c @@ -238,20 +238,17 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl, { struct tegra_xusb_padctl *padctl = pinctrl_dev_get_drvdata(pinctrl); unsigned int reserved_maps = 0; - struct device_node *np; int err; *num_maps = 0; *maps = NULL; - for_each_child_of_node(parent, np) { + for_each_child_of_node_scoped(parent, np) { err = tegra_xusb_padctl_parse_subnode(padctl, np, maps, &reserved_maps, num_maps); - if (err < 0) { - of_node_put(np); + if (err < 0) return err; - } } return 0; diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index ccfa3870a67d..c83e5a65e680 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -188,20 +188,18 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { unsigned reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = tegra_pinctrl_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; } } From patchwork Sat May 4 13:20:01 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: 13653962 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 21F8EC4345F for ; Sat, 4 May 2024 13:13:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 07585C4AF1B; Sat, 4 May 2024 13:13:14 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2051.outbound.protection.outlook.com [40.107.249.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id B01FAC072AA; Sat, 4 May 2024 13:13:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org B01FAC072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QcaVkUmsYsgy3hGwoc4viGWghmbmJckIyjk3VfgZyd0q9zykcuOT2r/Up0JHjRRSlaNiUuC+67e9b7cyrDO5Sz2n+Zq9fHPBwbDbbPjabh2l6lKIwGkgM8aOXyDbHdc+Mfi2osWQ3Rpvvl24REF5xLx2BB0BOW0q33p7alKyB1Rfxnf3s81JlFUP6NXETKywKjeLMO+InMLyLc7dnpetL+WqtcibgKLV8U3Yl/3IvsxbPEicFPN3udN1LbmkWnBMmEJv9pIxIT2Lee78Vnqd2W88RdVhcXjLJDphxU6nHBPxjil4fejb7CFw6k7VoxTt1jzzIGK5PZzt6Mo4uQMGYA== 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=TTUcWyDbCSVNKuwyH5CGkMM0CICuYlw4uOmY5Ln1Lww=; b=IzcjEHg3B++1mx9qN0aqRQmWrjGkJy1+oWQceAgzG+WmADqth92ecZ5z3vswxH5oEG+evbmIaZB6Y7z7HYBjdgChGEhQ5z6GJBGKt2Ad2BUtkbRr6CU9MCCs6s2VNUks/OZt4VUthFV/LMA7v/XlJRAl8SeIqd3saEd2Lzi+0ih1KJcw5wYLvxyCLaseo1sjcU2Us2OQLamOE6YOKy/ahK2+0silk14y1Vi97kfueW1MpJ1/iLQ4RuD8Uw6MXM6KIhVnBa54n7isYNvCVsDBOPZl6y++n3X9iiGDHqz1mzoxMxhysYITeUhO7n1c7NLB4LjKz2S2DyC2A6hTvmqrWA== 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=TTUcWyDbCSVNKuwyH5CGkMM0CICuYlw4uOmY5Ln1Lww=; b=gw5ShpcHbxX+/Xgfdkl6TAsvFPiMvIEC+Wi+Ae6nDPBN80+wYr5eN5N4wCs9HQdsZHVPCfURXlozR7QE89G8wt/kwGfWscEVp50pt1vIB1+dt1JzONplO4EaBHo6DN6kyJXhHSOlNQq/3TaVftMeT7o9rKj08S11oECy3aSVXqo= 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 PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:13:09 +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:13:09 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:01 +0800 Subject: [PATCH v2 03/20] pinctrl: stm32: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-3-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1139; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ghhx4F825SMq6fS1o6/f7VxGij7/D0TVS3p3q5rW72o=; b=W1ebSmJCvWCOZPu9H9k2jOBBLmE4aP3UkbMAeH4VFsI8NvpmJKE1fTQkEzyogXFOCywZ9HGuZ t/i1shR6m/HAeYvAKPCXfhOd309a+7YyiU7qE5UF2EXObsv2UvI//bP 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: a58bc258-71c9-40e7-3d3b-08dc6c3bf1bc 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|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Nbfv0wCQrmkFZ/H2CqFdPgmxPXJcqUv?= =?utf-8?q?2578h8N2IfdRjl56FN936oVTUG8wlV38ZZ8g/inHIgGEA//0t9JwI+HpWLLCPLeUP?= =?utf-8?q?51+VEuGt5mzqY1eqsTdvj2EEDhuLKnK4Nq7eVTx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Ack6qzQtq1kNG4hT4PbOrvU8fPckrZ1H7hPDkCn4?= =?utf-8?q?yLJT/p1EHLBCWhymFH7vklRUm+JWkbhmVDw0+5hYAn6pIw5vFrnmkJt047kGLjtvn?= =?utf-8?q?zJA2p6bd98FUqBXQgMF3Er0XJWko3ryyfsWq6VHjhNAKqJ4ouZZXR8+ynzjFykazJ?= =?utf-8?q?qRZaGiF3AHRgmKzfUl2TFKaNUMxfprBRWVg7r1wqZfgXgzHF51yAJUpqggQ0Hu1/l?= =?utf-8?q?BtFs65EwSyZpnDFB64o6qkhRmsIuJ4Zi22bqg9jF1TZvx9aEeOKjx3VqMOfj/oTv2?= =?utf-8?q?7kA+xc+QEEp7oBAxDakK3rMim1vC7hFCSdyb2D8OiDcKzl0UYYCqO7Lg=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)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aoHCj2Ekv80TfVrjn7hJXgGfxQjC?= =?utf-8?q?AFM60AlmRhcVU795omFMdy29KAkYxTElO9D1b4oxszXOiHRl6OO4PirsJGlxk4ZIp?= =?utf-8?q?6vdJoc11oNJnwjeC+V/l+NXcle05g9JqjR5nYWm44SjNN7JsryP+nqfKpV6cFPRsq?= =?utf-8?q?sUD4ieBcD0zUOgx/Yux24FxO1PkwpObhzahpoDbTbOlHtGCR+wkkO+PAJX9EBBLk8?= =?utf-8?q?pQZCVqke4TQxcGYdzbjznHMDpfP9kFF7vF+v2wTrHeeEoZIeK6vb30F4z966gWXka?= =?utf-8?q?/0muV0hSVfryo97Q4nVnxdwaCJPsq0dta11Ib0tE6WnYq8q2yNAnRb+4Y1h3lmGQj?=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= =?utf-8?q?O14PVXR5Igi/TtP7k7QhuUNuc0ZgWbGPPEsTlAFuMnPsmimR0QXxHlF1CPusuda8q?= =?utf-8?q?hUkjj0hkvw3Hi0L939YeKgCMCkCc1IpcO4Ni1R62/rrmXGshFnNuGAjiXlvzhXS4g?= =?utf-8?q?rjZjhZdGB3/WSxKZgs9ZZUDjbR5oun3qc7aj0tiadJTYHLv9Gwrxgc0SR3yMKzAyb?= =?utf-8?q?YQr+aOUfRzdkFNZdkNsb1Z0lpY4aiL2QcxrZeDMDPFsqQrcfQXOOX69FIA8ox2YSL?= =?utf-8?q?9MQge0f1m3xd1WqGLR8D0FLOoFc25qKaCxbbaZHiHlDeXk1kIjDc7I8k0iQt/fuoD?= =?utf-8?q?XWeOlrrSOcjX?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a58bc258-71c9-40e7-3d3b-08dc6c3bf1bc 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:13:09.5321 (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: J1GjQsq3v29c4m3/YXAs6Ektsn5bDk3jJgwDKomPp3mvw04yndm2r8RYRPJ3nySNDMLJSkoCImINANayGJ8DNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Reviewed-by: Patrice Chotard --- drivers/pinctrl/stm32/pinctrl-stm32.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 978ccdbaf3d3..a8673739871d 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; } } From patchwork Sat May 4 13:20: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: 13653963 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8EA5EC4345F for ; Sat, 4 May 2024 13:13:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 75990C4AF19; Sat, 4 May 2024 13:13:31 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2053.outbound.protection.outlook.com [40.107.249.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id A4A72C072AA; Sat, 4 May 2024 13:13:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org A4A72C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8dFrHb4e4KL7HwgGceMdwnIPATbwEajoCf0r1L751fG9TntfkojtXEFdwtU3+h4mGisBNyqodX9P/617fvvKWFPWxKVesYpSiNfQ8n/RRhkSVTQR/G4CqrXUZe5kqbNc18EwGKBOT+1RnK8SpANUOyYwY+SEYB4G6SDHCGZzWU8pzS94pMbF3xGWG6I0U1Y/Ik6reegZfH/pLahiWARc/kW1s+u3iYzsC1rwNBokyY+YWDlIXGS8lXQsaXkiRuluFYQu/tKOoN4SjT/5FMPs72IDiKaNoTvOWhm9gEZs1CAFtzVyUqLHFEOiFHuKC8zBN3OvjtFjjADEq70ZaZa2g== 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=2P30wZxS8Lt+11rd/nJOtDx2uGO5cN4rLrSAJ1jfCLE=; b=O62izbjHXj+4zdPt7+GiEoTPn8XodB2piI+Ga/xTuqqDcmWL9YM1JeivlJYchx61wb9HDbYxTJLgAgFo78/feSpBITmSsIsQX2uoJDhSRcT6zzZFFHcazvbiyvXEQYS8Aknsm1YD2Fgtg5D7ju3xiiP0MhbXDCDxFyRAUr7g8L8rP1Flxz13XuN2u1BOr8zF2XKrHV35s8AmEKn2fFtROZTMDgax8b0ny/gsVv4roL7RxmNYmvTuEgeMn5UjyvjEDOO+UCObxyNXu7b9BuyuGZTJPIdJO3NFSvTsSEj3lqXZTbU2W9zhsII+airVQrB9JAMhp7lkwyNT4Cu3blGHoA== 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=2P30wZxS8Lt+11rd/nJOtDx2uGO5cN4rLrSAJ1jfCLE=; b=EPpXBiBuohwFfGAUtTWvLzMJ2DMt4ltyln5SdZNBx/EDHOeCEMyumXCN8/sG48I8pRdal8qf6VU3jh7h5UhovOLHJgRoiDULw+dFDM21AVVJh135v+SO6E5K4vjpdQfOU1ITVUyr8xhWADRG989kAil8xzzq+wC9G2PYy63kYBw= 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 PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:13:26 +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:13:26 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:02 +0800 Subject: [PATCH v2 04/20] pinctrl: starfive: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-4-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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 , Emil Renner Berthing X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=6725; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Y9g/ve7R+m3W/e7zIx8b/uEfWQwRmgNvX+GDch7Of5U=; b=3vMnbw9Ysa7jrTpC44efhMT+UFQsFvhEKHMRSieT7F1Sbddy2bEGEc5EfpALwgSvWWAxat145 9aXjF5wEdpVCTILYnh3hhNbtAWkA3LZyCxa8WDZMWvRG7MOlkDt1Wen 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b5c4df5-44d8-4c73-20b1-08dc6c3bfbe3 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|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+gfrw/c0aUOQC7aFNAxcqO0bhyUV052?= =?utf-8?q?FRMAXxhbS8Y0RQJM0uBh8b609+gGNG9mrLIkjHeE4a+CG0iHIiYZOEMi/r3wQfEBL?= =?utf-8?q?kq0OF7xqPPLLqn1ERVpMXJxJpPVX+VUG6iZNWT6ocCQlcsayLGI62HldWy4Tq+164?= =?utf-8?q?6jxyc7rvoyRUhdCV8ddn1Gb+brCnRWNiTSDcEzhGV9lIIjWH6gKlHx/LjJjPlKCD4?= =?utf-8?q?aY0+sNEmaB8o0xh/b15mc0EjS+i4snCgj8OnWFitxuuAK1Um3W+k3FEWc1QABMKuh?= =?utf-8?q?esKtqgFddd22TBDzwdkxKFsiOub4l2XoWPPgHgERJ13TYHoSViT4YgC5hir5azKs4?= =?utf-8?q?8Otg5F5dRVAa4SrXGqHfK7BrAU2ZVfLtB5BXm043f+PCbn3ywd+onnmJTyDSA4gn8?= =?utf-8?q?5JFdvyV2lacrunJk//jf4XZQmB0S597TeDqjzCri/8xYYbrxcrq3E7GrfRuoasAn+?= =?utf-8?q?hl5AY1hB6kZQvH+CGByWVeO4M+SvpAbjPavzj/g0icszTbaxgHLWWH5/iijzt0uv4?= =?utf-8?q?AOi5FchPNUCT2oAFrvQofX608HsQSf6SV9p2X2eEhXScobQuxMLVgKaq1liaotchB?= =?utf-8?q?xjkmgQTwlvLZt2UI/sKEm4KFEQlP8uKOCRHTvpnVfDHvXDZ2HUQcdUgylQg0paLoE?= =?utf-8?q?EubTzm4sLZyXfh4OQcpkJ10w4Sky/n54Yeca31zC7tm52jIROMT70BbWDzAp9+jSN?= =?utf-8?q?johD+ipimW/N/CdJPPhLYZj0aKdboXz/YVTbDUaZpamdYJmHLkPIOoiEd6NCz2uQx?= =?utf-8?q?z2vyfyvwkkNRILi53/JMidWRsORGinWLDtB1ceGGIfHTbdXXRuytlgjmMNmZlVMD7?= =?utf-8?q?f+r24Ldj1A9aAOK3HcpgHGLUHpn1l6TFmJWSTAWgC5llg1mCR3cH3MEHY8G/iNYjH?= =?utf-8?q?Y3LL6hvEwNRcg7ye3DfAtKjwOMxW1tD+iawddBy4EnP8XtCouUv1C8bWV/3GsNMrK?= =?utf-8?q?n0VAiw/7sNZX36iz5l1Q8bHPgsG1P9x8NCYNkOq0NEK6JU9VrVfLUO2z/tlNmjeKw?= =?utf-8?q?ze/O8RqOLd+IRx//rOiQLHTN+ZOfKVKu/I9UyC2/Q6G0xdcrSdKDZo9GN+WuQmEZP?= =?utf-8?q?13MG4kKNrAlcSCX7EgPSGh2MloVUhUitG+Yy9prKeWcSmAYSUw38+9sIiH7wLdnVW?= =?utf-8?q?jDvJxcWGtII6jW1nwrAKyc/alskPVQlqV2Dl3xy6Fu/LdNTR0VVfAd/uLQqbzNL3o?= =?utf-8?q?I/2P+tDvj+5KYwPPoIjWE03y5ldU9BxJitkMWtj2WlkEWVJ/fH6ockSKl3FBufz6H?= =?utf-8?q?7P7cpbY3ZkwhWr+UxN7WtDpFuauAHUjj4roOv7Z8aHFjl3q8i7IQtP6s=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)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101;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PLJXj83d+a7TIy?= =?utf-8?q?loREVpRKxO9iR9k+EWstXL6VD6Ur09U6mzf3TkKnqFbG5B0l17A4UY4eoKLhvJ9TC?= =?utf-8?q?aVRPrHcBCymxul8ITBP23A0dNaPud3mHUm8+rlySfM6FBExs4feiy/bQPs5kWg7sN?= =?utf-8?q?ZnMSX64grkU+lK1YQOYX+RVZp+S4c8D7U82roEDa4eGKr6rFeVOjv8bgUwZeubF0A?= =?utf-8?q?zTuDnxYg1hTyqIP752EhFSoKRdgTxiUAnTiC9ThSobNZnxTPRF9lDzojQgqgtpZLh?= =?utf-8?q?RSzw80csjy5epalXPI/GqZipwAJiPTgBTdDKB/SvY7J/Nsd27EDVNjKTXA2pWD7pr?= =?utf-8?q?VYbyI+kpXxibhCPAViqjjypl2lGApFJdBUD9Bm+rlGLJxI4rh9sp9pyqve4ghAvHp?= =?utf-8?q?h+1MPKo2oXKakqkYRdQGNuerVHfwwAxLZmVELEFEoRt9xuUhxDS5vxswBwTYC0wbr?= =?utf-8?q?06ta+A/9dXfIgjO2oqSmR2jSqh4fvHgQFxlBYv9daF0rntdzljTlXg1KuMBGdBLb/?= =?utf-8?q?Y5CLCfuWBCFBXrJxid+29cNR7btMw/SqOlJG6U8C84eU2ysKLWqqcAVMtig15aFzN?= =?utf-8?q?wscxr9/b+p1Xz1H5uTyPrLn/fnqhSgl5FqAcnYmxYPTTcE76ioGNKHJBBaS6OAqoC?= =?utf-8?q?NEyIZRpC+uxx49KHxHTJndacYDlfTNxdcCnHzuiL2rxNDZXthDH4qtOAYpv32DzYh?= =?utf-8?q?9COHf/VGFMxv?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b5c4df5-44d8-4c73-20b1-08dc6c3bfbe3 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:13:26.5554 (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: IsKCV3MzsPaHV6FuLQIUwE1z3AlbnmuFE+6k6bOen/PYAptY1ACmRlUrV16UCorDIjT5k+tijSoDho+Qyfas5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Acked-by: Emil Renner Berthing Signed-off-by: Peng Fan --- drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 27 +++++++++------------- drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 18 +++++++-------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c index 6df7a310c7ed..27f99183d994 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c @@ -480,7 +480,6 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, { struct starfive_pinctrl *sfp = pinctrl_dev_get_drvdata(pctldev); struct device *dev = sfp->gc.parent; - struct device_node *child; struct pinctrl_map *map; const char **pgnames; const char *grpname; @@ -492,20 +491,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npinmux = of_property_count_u32_elems(child, "pinmux"); int npins = of_property_count_u32_elems(child, "pins"); if (npinmux > 0 && npins > 0) { dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: both pinmux and pins set\n", np, child); - of_node_put(child); return -EINVAL; } if (npinmux == 0 && npins == 0) { dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: neither pinmux nor pins set\n", np, child); - of_node_put(child); return -EINVAL; } @@ -527,14 +524,14 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; mutex_lock(&sfp->mutex); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins; int i; grpname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn.%pOFn", np, child); if (!grpname) { ret = -ENOMEM; - goto put_child; + goto free_map; } pgnames[ngroups++] = grpname; @@ -543,18 +540,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { ret = -ENOMEM; - goto put_child; + goto free_map; } ret = of_property_read_u32_array(child, "pinmux", pinmux, npins); if (ret) - goto put_child; + goto free_map; for (i = 0; i < npins; i++) { unsigned int gpio = starfive_pinmux_to_gpio(pinmux[i]); @@ -570,7 +567,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = NULL; @@ -580,18 +577,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, ret = of_property_read_u32_index(child, "pins", i, &v); if (ret) - goto put_child; + goto free_map; pins[i] = v; } } else { ret = -EINVAL; - goto put_child; + goto free_map; } ret = pinctrl_generic_add_group(pctldev, grpname, pins, npins, pinmux); if (ret < 0) { dev_err(dev, "error adding group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } ret = pinconf_generic_parse_dt_config(child, pctldev, @@ -600,7 +597,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret) { dev_err(dev, "error parsing pin config of group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } /* don't create a map if there are no pinconf settings */ @@ -623,8 +620,6 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, mutex_unlock(&sfp->mutex); return 0; -put_child: - of_node_put(child); free_map: pinctrl_utils_free_map(pctldev, map, nmaps); mutex_unlock(&sfp->mutex); diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c index 9609eb1ecc3d..4ce080caa233 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c @@ -150,7 +150,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; mutex_lock(&sfp->mutex); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins = of_property_count_u32_elems(child, "pinmux"); int *pins; u32 *pinmux; @@ -161,13 +161,13 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, "invalid pinctrl group %pOFn.%pOFn: pinmux not set\n", np, child); ret = -EINVAL; - goto put_child; + goto free_map; } grpname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn.%pOFn", np, child); if (!grpname) { ret = -ENOMEM; - goto put_child; + goto free_map; } pgnames[ngroups++] = grpname; @@ -175,18 +175,18 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { ret = -ENOMEM; - goto put_child; + goto free_map; } ret = of_property_read_u32_array(child, "pinmux", pinmux, npins); if (ret) - goto put_child; + goto free_map; for (i = 0; i < npins; i++) pins[i] = jh7110_pinmux_pin(pinmux[i]); @@ -200,7 +200,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, pins, npins, pinmux); if (ret < 0) { dev_err(dev, "error adding group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } ret = pinconf_generic_parse_dt_config(child, pctldev, @@ -209,7 +209,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret) { dev_err(dev, "error parsing pin config of group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } /* don't create a map if there are no pinconf settings */ @@ -233,8 +233,6 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = nmaps; return 0; -put_child: - of_node_put(child); free_map: pinctrl_utils_free_map(pctldev, map, nmaps); mutex_unlock(&sfp->mutex); From patchwork Sat May 4 13:20:03 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: 13653964 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A26A5C4345F for ; Sat, 4 May 2024 13:13:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 68A70C4AF19; Sat, 4 May 2024 13:13:47 +0000 (UTC) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2087.outbound.protection.outlook.com [40.107.249.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 22385C072AA; Sat, 4 May 2024 13:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 22385C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEjKrZo35vprb+ulRKgA5XEBXHoWfX08dfs+rfUGfxW0PsNaNSU9X++A0D91rq55txf6Zy4S4ePWFyc3OH82pZbecy7zdz7TQC7fBUgYQcgPAO7Q3IrNPuR9YSP7nw8jtNStd/k8cZXy7gFXjRR990xlCjeastrPzUx7wQ8z4Vyz2vO1Eq5DpKinHWAYdVbDIJws0noJf699InJsQBHFd9+kvwCiPaoFVx/lluCamNaECO4LCyNpV0YvyHioneC+69uXv90rVJuM4ZtfC6HbwLccnV8tt1fEXn/Z8aD1bdmXDcBmh0tKeQX9tGTkLtESbvGMP3WyPY5LLbLDbSQ2sQ== 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=IpRShFXqryoEfTWHOcp1CIk6OH6s0zqw6wy9MuhFPbdKWLEcGix0ULHFmGU9yaQCohNtVQtwHDMyceNi6KhS+hQpo/s+Chi4ZII9dJ2p8Zk/ItIfMODcyWvD4kQlaiFlSl237zSxkn/KWkkWUgbCkvwYuxDVH4d+f+IBu3BeilfYqQhoDFcEI4jfy1fVOvpPbdVboWQlXCIIMI4c37exFBI1IyMV4Rrt8At9gyOXWdHgvKk0h2ACW3ANF/2IWzzn+e7HI6zDdB6ZiqLI4NNUNjafCqWulT0cqU6iXvfYw1jgXJB83eb6u8Dvr1NOER0e5eLy1yDLjCIBwpzBP0E2UA== 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=NpK/lcodQ9pE5BbJNbhQk3YjH5Nhyb1JmDwtplCNwBMtXa1WcgJG0yq/JeQCSa8Mi+kNwkwFW2xk+0BZq+jFo54RLX+6FZWwJajiEHumfZuG9ozhKXVpQS9IfB03auLP+qXSrU6Nn0lrmX0rES7yPc3mbezMfUNTvvJLmgrVtSM= 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 PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:13:43 +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:13:43 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:03 +0800 Subject: [PATCH v2 05/20] pinctrl: sprd: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-5-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1540; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=BMqLHOrX8EQjg9Z3uUGPLv8QrQVTIzjrj8QOQ3y5znM=; b=Ugm0fFZvckU11/gZlb9LPokzX1/XETwbD8kMAjOF5h1wfoVm6mH4BII4a8+jjdOKtEdnq6kb6 jei5lzvJulvAYZ2W6id9lnxq2Oa6z3vUfHWLegACPLLaaZYeJIhnMjE 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: ae48280e-1957-4ec4-2bf4-08dc6c3c05d4 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|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?bTtQBfKR3SBxU7O1P3WWfDnxG6GS9bw?= =?utf-8?q?dG+KzRpG/0gpEG5tMsIGl1rNUJ7t2ZqspOGdvhppQZQCeOoIo2WqYtGW0b85MJG4n?= =?utf-8?q?dW6KLbWWwnocPlol9Y1ZO9Zx361MZI2JdPjU3F1nA4m8SDRKRK//MPA1XScbaK2/b?= =?utf-8?q?xb4iJ80gV1khof5CUTRrbEtztH1uZDjLfSJOhVULMBAb0wtay0pcHesFdopXWcQtt?= =?utf-8?q?DsMRiKE8PZWST1yR6SO/ihRRI318RXISG73K3WTzbcylFNfNOzq60gOlmQgtIN5Ql?= =?utf-8?q?mPCLk7Gf5FCVh9IcgsXCZPHvFyH12Uud0k4VdhDUc+Nij9Cm2m0lv4Zk6E7ZUx0di?= =?utf-8?q?wXAgpeX0AGKxSk9rhcmELmS1id5Zi8LzPCYuFxCtzvos65tUsDh4bOZFvrzaxKCKG?= =?utf-8?q?tEes1j/FrTGlXl2vn2t8VZfAIpj4dloiZ4cjZoRt96f6su8PwM0J4toKKBmuYG9GD?= =?utf-8?q?KFA16PQmtrXbBkj1mzfpS+woX14AB0g5KvUHGiErQYgZMowGbUbDY58DF7yIVUMIM?= =?utf-8?q?R3rMsKNcOjBQ23YCBixQX0x6M1cqlqKOK9cz0W7gddv8s4kK8C0mAmzs6N2fJUr+B?= =?utf-8?q?qC+HOCQD55hYLPvNq7piAa4BV04jkZ2VHVpwgyxRrcf8sQ07jFZx+hEKezekaNg3K?= =?utf-8?q?R6yjaJpQWyxjEffZ/pIUliw5lqD8u8h+NrFOU4/TP4v0u1G52ulw5ATikzogRVUga?= =?utf-8?q?zxRORhbS99M5MVTwOpiMVG1saRq1HMp2LJ4dCCYiBnO6Zzm32xDAJ5DLtwmHyvQa1?= =?utf-8?q?YSogRzdbfnv1Fsb/eA0NPF5S+ozsKbAQCrr/fqOGcFnzbkfhuSayzojV/2tDlEtYb?= =?utf-8?q?OJxKisIiienay8vjxPeDKB3UHrAuuMm+4ZC83451u5TERsgAJe1rxBKdi5d8YMdgg?= =?utf-8?q?b0VpFpEohA9ZkZdYQuqYI0tdLvcbfkeScUKvN8aA23EQpdVC+MSuOSBVs4LDP1qxl?= =?utf-8?q?oPtnRwU05K46KRqs3sBdpwlIWAtHWUaRXkKkIn6OQWr1xUa4AvEv+gEcrqbPUdAI+?= =?utf-8?q?I24HVzzCryCju0yz7Itq2DXIx6sGeCt5PfWYbIgAfRGEwZhljtGFLQooc/Psidoxs?= =?utf-8?q?a3TAPpRQVYCqIP0Q4aZfjWk0+SncIj34C9R9WSOXxZgGNvjkT3wAhlI1LFXKe2RHc?= =?utf-8?q?GACJcoUwQeme/oZLtKrqLcG4Q9Sd6wJ6usaskNPzR6lFneEUwq0Gy0I1lw4Q6kwyp?= =?utf-8?q?xtLz/8DuiO/5LoECRxXaU4T8tEiW+RGtfqZv6EraoPG0yUThWlY6k2oHaq4mqZetE?= =?utf-8?q?SkPr9sZKRu7D4z6V67DRGjTow0l8Koi2XeQGjRkSP1bAuF9+W/v3yXEw=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)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+R73NcYL5H4DMT6p5S/gB9/+ixXq?= =?utf-8?q?oBsvtKLCSTNY5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lbMXGDoAxZiZI9C0ogKfCOJKAw4kkf2jWBQaFoSllHUZlwp?= =?utf-8?q?sLU3/Pi5ggtlRirsXy8CdAdLHvu5qFbQsi3vkPPT5Mrk7Li/5wnQgV+YWLmveec6U?= =?utf-8?q?XHRbCjZYgkbxPfgmKNkRjnNWY/V3W6v1YxeTTQNf01xxbpgCWe+0bVUnqQYyDx7uB?= =?utf-8?q?mrlO7yAUfgBIGSyCCqx/uwE0fF6AZAz5noWEQ/yJUL12JbBtdE08VIlatRyJa+Oem?= =?utf-8?q?ea1lUlwW/qfIPHxGQZ3iTBZsnrAzZPD+4tdRCq5fNlLDrj8LoMBhTyW0Pj+mISbo5?= =?utf-8?q?IYxWrL+AkY86IXUAuf9EjFcrzbmEoCVViUNlW8miswJ2V4fcgwKtTO9+rRZnUhfC9?= =?utf-8?q?vGnWYvfw73C+eErswCdBabDrDRvqExzgAiKo+QatKEvs+zaweg1V5hHWvTRZTxTlW?= =?utf-8?q?M110i6ZdfA35kKqjbfyxjShVi6YEeZFIeofmVnAWrhvOdhHGr4UuST7WdV5Q6D+25?= =?utf-8?q?I0Upymbr8bLL7hAAbDplZ2lwU5Z8YbRTvutKZmy7U/GDIk5RG9qv3nWRoU9XRMUgX?= =?utf-8?q?qYlRiARz2u40hi8htCHoDC4iIVGAi1bkLxtku+KiM5xUwWL38rADVr0BaQNkVughI?= =?utf-8?q?8/WS0Bc8JzhX?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae48280e-1957-4ec4-2bf4-08dc6c3c05d4 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:13:43.2390 (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: xBz/wo6jszy9seIjpFniB9zAk6LmJZ++0AvHsX+MUpveQib2IRf6H7bVmdHZ7jXUcpz7/Ua5/Cme+TomydhrMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 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++; From patchwork Sat May 4 13:20: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: 13653965 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 38FD5C4345F for ; Sat, 4 May 2024 13:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 289B6C32789; Sat, 4 May 2024 13:14:05 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id B875FC072AA; Sat, 4 May 2024 13:14:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org B875FC072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BB++BuCWovknZieJLe0ezXwJ+LlNNUJmOh0r5XrnwAwWqL9Hl8BKUM0C1XizqtjYZfZ0i+bX5qH2cv/biMOHoFZfdjxbjDDKaGwbGOEPf1+IEnCLneloZqj0Jfpk7hNcEFVo1Yr39KkUcd8NAwWmbp6oKWLA2LvtQ8EfgcZd8cYg8xeV0LUBUUOkt3FoC2GUyBsVqSZNOE0XExVjRQkd6RC+joEfrvaxBYs9aKd5wlylLZNXITXpAF3nHYZKHlIBPD0EevH7lE2F0rIbmam7K+ZeUxgJkrZwhh01QyD+qBT41Smn0I3+pq1mVBkvLLqKX8M49lpF9HY4ADjmZdX5JA== 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=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=ZmFpipRA/d0vqDXvfI9t2oC+JpQwtgSv3XbrgR6cvNx9nIZBw60DisGv1ZoNEkio6wqCcHPrpGcw+J6e/JtxkGU9mWcbYR+OyORhMgz0tI+G2p2uZPpyIqJjMH6IwEv8+zIQZb/tjOAfpqPCbenJPKDPneP2+gQeqimhb3fDzspZNZpMJSIhbca0rKMq6r7GpAnOoLDN2ssRp9kaiWoVK3Q+rnj0Ph0r1NZBS7ZqBZc0ug7hhBF4OHZ1dFVAfetlD2YqudsOGFYdL5cbwD997ZgQJIe5/ETDjVZWS9sz6fU+kqHQwF0KEwQQAvR/rbAcryerI8aZdLy2tLxWwCA34Q== 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=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=K9HoFs+8inZwiLNq5Z6MwNjq7DYsbc8JTeDqn/VxH2PSLW/7PNxhcix9EnzKWVNkwzRETbUqiIwcU4dbsWNglLL+0n+O7EcO+MsssmI20feQ0DIJuT+FAKpwdmWX0s03dV+f9DS7nr36WsAprRd03x2hSVbg/RedEz8stpoDajc= 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:00 +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:00 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:04 +0800 Subject: [PATCH v2 06/20] pinctrl: spear: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-6-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1599; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=gLxq6qceZG7Nsihhv4/AWrdppvVafau2eKIInT5INMM=; b=5ffTl8ZtioLSYaaZNjD41K3m0KxkH56uyb2/IQ3LQ/eLhFTIgJ+z+teWheN9sal8KHmc+TJHg AnbJfBYdZnCAlHsBRS1fxFEmq8MQgiKr7ur+z8H1JXy6MJM4yebyMux 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: d6598716-c0c4-479f-c7a2-08dc6c3c0fe3 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?v4QQD4arqp324xwEu0I3XenXYFyuw44?= =?utf-8?q?jF4y8CXbektIia+4edMloewgv4Jij3cvDp672QGahtqzG0N3hBY24JXVacPhSA0nk?= =?utf-8?q?YyMnK9YW8vb0vQDflfUVh0S8bsBZ5EOikNWaFSnDnX+p32JhkrsQr/IOaPhbZ6cHv?= =?utf-8?q?pZ6bfrXdyreJ3T1xW5xcstRCu5ugOJE7bteLND1M/xx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MZckRixsf7Wr/iwCl?= =?utf-8?q?hqAPwzM3Eg2HurogTVnwrpQWUu2mewTWEKFHyH5231qbv8/JFtIhG/hKIl5avoRMV?= =?utf-8?q?BlHcSbMCvzLI25PlDloFuUIvnI6ohMwU1bfpuE/LY2TknTFBW8cQwrcagRxhI28kZ?= =?utf-8?q?rzTJHI/43w4El/3/zYuGyV3qzdrQ9pka8QicjNO0jaifMdnGh9Q//pRmY4oYQxuey?= =?utf-8?q?Xt8EeForY+/1ckmGgN2nPodn+Cxj++E8zHGQSs6kMG0dJETboHMXr7ZM=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?/MCkjX5+ilHcYff4afOrwUp6YWTg?= =?utf-8?q?DeQxme9mvlCKQL8CkHdcGzCHlXVCEcZYUE4xoSReicM7NjDLl8sawW+mgIDs9Z1Zu?= =?utf-8?q?psJDwzINEu7H+I4WWYBcHyVL43Y8YJep+b02EGPKMFfFnEBGL9XiJnaJ3nJqR0Jnh?= =?utf-8?q?dNpkzMXvON2YYdW8cGiMOFLr8CR3APHQyLczUgY9vPT+x8RQc/XvELuMJCZV4xf94?= =?utf-8?q?RJdeeiM3lqT3HUWKikLq4IkpALhEnyXm10D2BpnlSK9tscWA4FQj4kuGcoBaWDx2U?= =?utf-8?q?kt/8xaA52nW5fdFLf4hesHpw2/r145Zu5uPbbJC59sW40DviJBnMZX8kzndUQuYbl?= =?utf-8?q?hW8SmzDs4ukZiVhN6zkos0XpW8K6SZLyH+d2DzCEO9iEov4XyCfrEYZpz3RyEPmtu?= =?utf-8?q?+R+FDP7f+utiAP3iqJzdGNORq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6yw1EbaFgY5IfCZ7HMWBJ0hLFrHiNwII?= =?utf-8?q?vG80z6TzPhtZzIdonG4p+jOMM10sgnYq9iHk3bZDWvg62xbT3FRn95PUGE8ukJh7P?= =?utf-8?q?W6GWxSniMT9pUw0YSepPChuDH3QFIus76TawBwP+9yDOC5BTVixWxIDwKy/aZd1Ln?= =?utf-8?q?ptrNsh6WZJfC2pf+hCeXETzdkB5G3rmYG3tdjSuBtAgniK2BcUWJ1GaUFhRg4MAwP?= =?utf-8?q?gc8fNxfZlsKA?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6598716-c0c4-479f-c7a2-08dc6c3c0fe3 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:00.1186 (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: T+cymmIPNQaUTjAAeGY7giHGdI+UShMOKcu96YfvdEpUl5E3Du0kUO7KnLBy/GG82X25bBpZf2YVHU7iNXWLEA== 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/spear/pinctrl-spear.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index b8caaa5a2d4e..a8c5fe973cd4 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c @@ -151,24 +151,19 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); - struct device_node *np; struct property *prop; const char *function, *group; int ret, index = 0, count = 0; /* calculate number of maps required */ - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = of_property_read_string(np, "st,function", &function); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } ret = of_property_count_strings(np, "st,pins"); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } count += ret; } @@ -182,7 +177,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (!*map) return -ENOMEM; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { of_property_read_string(np, "st,function", &function); of_property_for_each_string(np, "st,pins", prop, group) { (*map)[index].type = PIN_MAP_TYPE_MUX_GROUP; From patchwork Sat May 4 13:20:05 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: 13653966 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C6843C4345F for ; Sat, 4 May 2024 13:14:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id AD5DFC4AF14; Sat, 4 May 2024 13:14:21 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2064.outbound.protection.outlook.com [40.107.22.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id DC519C072AA; Sat, 4 May 2024 13:14:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org DC519C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e043KH9dCq8dWsmfeKQz3zMn/2C2bwJ7dl9LaOvScQd14Z1P3BuRUHiMQ4EWL2AX5BixlDRrF7G7hVqQ++bU27UsDQtNXIq+J25bfb1K+5Y4ewzDXjbek/UF1hq7yzVpFkX9i4zMiiBtcIwKWAFVxIzPXb51Ksfaf7FjCyQMPT1YNbluWlW0q5qZuVGhjNDDd6N1n8vftq18l6YfLwgDxYiSgzq1ARS3PPgXTGBuTD0M8dx2UgJcq6xWaWskZjYb1xbAg2lVRq0NJ82mgdVYvS/bLL6407xQ5iEbwcMgpMwkY2S/1aR7yKPX1fEKU5eesuS4tD18E+Nv1PVUQDRXUg== 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=xlpULG990sWFrI+9qxLt0ZBE85TdL60SLUPePmyaqSI=; b=O4Y2ScxgswofbZzRbVgTs64eSe100TK3S2nCZ+AafZ9bEEj7qu83tE2PQWUOfGYUt/0TDS4qPTzb+H2FYqHg4vtV9w5HZXKbXgofb6jXJ33H3SRRPoIyrRaCr/HXcAFG294xbPbrXOST5EWAojyL33MHs926WDQvsfy3zAqF9Uy4zGQi0sim7dbbyTuMaQsE1YZX5O6O+BLi2MBQlQ13uRGqmL+e2U8kB5iZhfv9964jflVaTOGLwKPUhRpShPW9m3TPQQFBcvfgwwlPZtLZRtjeS257Z4Wsg8DXsD0LG26zPLiNXKyuCwExzHKRMNFfX0P2j6yER4IOHXaRf4bl3w== 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=xlpULG990sWFrI+9qxLt0ZBE85TdL60SLUPePmyaqSI=; b=CxNGfzcZ5jiD6UiFRzRV/406Ja8hQdGwImmDedFo6vSUAQUvVkb3fzxh1GmvkJ1+XRFIqmXPR9HqH/CNFpIvjFpmwMpnfOiqD7kceQQxiLXcuwj/BAIIXKMeHxBq80IcdBY527TNY2zfTABkjJFsegOU2y5BtGpEDMU1DONTAts= 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:16 +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:16 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:05 +0800 Subject: [PATCH v2 07/20] pinctrl: renesas: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-7-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=7378; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=rblCQQjgjZSJUmkJHlAJdcDG19G0fEKKnoN4VoqDxp8=; b=rP64dRmiJWkjbNAzDUBgxO/jiMdNGY2Dt53nxwhfN/1GpjWG/i9oTL6uo0n4rFB9bCsFKaLFJ jG5wo4Gqa6zAfFCB7rn9+S0tSvNdGYgf0P/NDnesEBdMWd+TqbHCddq 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: abac60bd-c623-496b-f9fd-08dc6c3c19d5 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?W4nB9+BotIUXWoAXy4d8CKPUZvHx+T6?= =?utf-8?q?HpViASP8rK07QaoYH2AnvU/bT9C7Xr4UUVziLlRvusRXetHfwOVm/PI7iO6QsZS0J?= =?utf-8?q?g6n9knuYbA3iVOfzea1lPBHPEsJEatY+KMPRYUBNpaXsSnF3irHdb3Qd0C4slFmkw?= =?utf-8?q?VPkVUHB1YCJm4DfBhpmMWEgyzKSvEANco6lvF7dE1nz9ZwQhtOoiPiVpC1e41fBhv?= =?utf-8?q?ja29u84t+bMeftoPh4Tw+pt34wDqkVbHYcNwy6UYmU8YscYW4OubLYEsSehD2E9Zm?= =?utf-8?q?SMdtMYWqrAODPmbJjelymBBmVMa4Cd3x08S8IIxFDRSoenbnZcG2LBauxPiqyaG7o?= =?utf-8?q?mbvsQA4gTjDBM031sIPWDx2zIsSLAeL4l7R8UlMzRZ7ae6advqEtjhQkR5wo6XRCL?= =?utf-8?q?gsACwislJQsnh8Td24cy0ssh2qQvdiZD2e7frMNaY1XI0NJaZxJ8lbQmzwn6GTL2l?= =?utf-8?q?liaWQQgSjeTczPBRRtSvgMafVcIqxfJrlg3RpQSq20RGcLK2zikdA/XGySLWd4G1s?= =?utf-8?q?lLtTNvF7vgIsp7bXsN+yUDcD8ZhsbgXjjgWMQ8GyX4gmSToH5mwNw7XIyL3QVyEyy?= =?utf-8?q?8UkN5zy8ElMGW1cjSykMSWk3Dz0syxpw3K0LBidmaT04a8c3/8+w3H2jt6V9wugXn?= =?utf-8?q?DJN5Ed4l2rgx186o+N2PENwy5man/4sM3zFo3TVJpnLrwAhfRFa0Q+5L1t1oQYk4m?= =?utf-8?q?mH2Kgc6qa4EEjseR6e9UMeYaF7ys5b9htT3n+nKUya476SJTteKu7VaSp85qrJO9V?= =?utf-8?q?teQpi4QQc0aBO+pMaVnUiaKGc8fzh3cvjTTdAcpdjitUcam7vB56mAPiJ9X3YQvgw?= =?utf-8?q?aK8NXwuE2qvBWuLm9Pyi4OVHzOdVGwYXsgLBP+Mhv9tx154rgk3/4OadN6u88CIkI?= =?utf-8?q?F1+0sHiCau9WQpklyZndqCTIUEV8rPQIVIVPIFxIEW5+zrN2GAasRoYFaqrpgGKou?= =?utf-8?q?nCnoqZ7EkPiCdYkOpzli2/K0wd7ZDAeIbyiYnD2qdOSO6rQGi4VLYBaqQlbbxBhf0?= =?utf-8?q?uH9fl8EwAw1mmZErskXspPZdGBeo4hsFsusJhyHCfuQfc6Rri/+fTD1xxVA67x6Xr?= =?utf-8?q?O/7c2Neu3iCEMnTv4HgbIzueTK1WdEi6zSdPR4k+x2DZfpqKTNDqvZWy9/vaAJKwX?= =?utf-8?q?KnPl9RKRuNjxpHu3yp7Mal6CYabPHj69h+BENHC2pXeX3Hb6ga8ABVDcRdU7qKKBR?= =?utf-8?q?21U16NuajYqDhZhEx3Sa6qLaebPuPoviK8NIdh9wPe7kFLn0LTBG0I4NKKr3PSv+I?= =?utf-8?q?zySGr892utjyrhbnc5PXDsvU+nCydQ9GaWg=3D=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-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RqRdH+IbE3fmspurLemc?= =?utf-8?q?ubtSIfmFESn4NS6UsjWCKhrC0lDuKlk3cmL95HF9Rfy6NDuh+KBfBmJ4oSSMfZxiW?= =?utf-8?q?MonbNAWH/XzLNKEfcOGS3R4G9koXJ5S7V8tbbECPUKHwGlnHd5893fwUDYS8LAeK6?= =?utf-8?q?KJ78pzCwMH4aEAmu2IvW2p4WNsAIQh88CS+uut/NugeYsgHmMrLkzHW8nG/qhWW81?= =?utf-8?q?pByp3HiAuSQjjVfiBnA/IDneelnnzoYEHIU3a/vxf1ZsrYt9fO0oZJ7UmMvkf2W00?= =?utf-8?q?Iw7VdoLnIGWyfcRhjwROFwDPd51MW4XFk3VhkZBwKTT4pslKoLlKWCMyr8/LSS911?= =?utf-8?q?XONe8yeZl3HacGJmrO5xrN4+t14/irkCt713LoJvgoTf1lTNY/1OQdGrXNYxOqLnm?= =?utf-8?q?ZM92gCEhnhGFk/ibk1+AVQaGXFxZtChkCR6YtFp3oXM8C+ntuSfpYh/4imxrnrnNT?= =?utf-8?q?A/gLn0+XnrtPetCIhzb/umkedJBZ8P0Vcn68MQW0GELSjKxLXg5GbxCouwMOC6Kh2?= =?utf-8?q?tle+HsqDcQuM006JDBsBUKU1+L6o5AL7P2wCuzTgzKFcND4qMZY0P0RRsIy5Tzl+g?= =?utf-8?q?fayFqs36ASAW4WsmlcBlwf5+s3VeuOnkn3RAuTJeD7RVf/wFCZLmuje6nc5IE66aZ?= =?utf-8?q?JmOYMR2d7wuBteGGPxK/3u+hnthbkZwRS5lW2K3PBd2bmP7QVM0/AoFNHEYBxA0Y8?= =?utf-8?q?/F9tv8Jgfwys?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: abac60bd-c623-496b-f9fd-08dc6c3c19d5 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:16.8086 (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: D7c/JWrShKmGOa5H4afl1vGgxSkCzZarqCkczeKZcBRMQ0KdqvL8ItqXWU6PkgfribG/1Sy3XlXOpFVDaCef6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- drivers/pinctrl/renesas/pinctrl-rza1.c | 14 ++++---------- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 7 ++----- drivers/pinctrl/renesas/pinctrl-rzn1.c | 23 +++++++---------------- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 7 ++----- drivers/pinctrl/renesas/pinctrl.c | 7 ++----- 5 files changed, 17 insertions(+), 41 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c index edcbe7c9ad56..6527872813dc 100644 --- a/drivers/pinctrl/renesas/pinctrl-rza1.c +++ b/drivers/pinctrl/renesas/pinctrl-rza1.c @@ -852,7 +852,6 @@ static const struct gpio_chip rza1_gpiochip_template = { */ static int rza1_dt_node_pin_count(struct device_node *np) { - struct device_node *child; struct property *of_pins; unsigned int npins; @@ -861,12 +860,10 @@ static int rza1_dt_node_pin_count(struct device_node *np) return of_pins->length / sizeof(u32); npins = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { of_pins = of_find_property(child, "pinmux", NULL); - if (!of_pins) { - of_node_put(child); + if (!of_pins) return -EINVAL; - } npins += of_pins->length / sizeof(u32); } @@ -986,7 +983,6 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, struct rza1_pinctrl *rza1_pctl = pinctrl_dev_get_drvdata(pctldev); struct rza1_mux_conf *mux_confs, *mux_conf; unsigned int *grpins, *grpin; - struct device_node *child; const char *grpname; const char **fngrps; int ret, npins; @@ -1023,13 +1019,11 @@ static int rza1_dt_node_to_map(struct pinctrl_dev *pctldev, ret = rza1_parse_pinmux_node(rza1_pctl, np, mux_conf, grpin); if (ret == -ENOENT) - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = rza1_parse_pinmux_node(rza1_pctl, child, mux_conf, grpin); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } grpin += ret; mux_conf += ret; diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index c3256bfde502..fc7f33d3c613 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -745,7 +745,6 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { struct rzg2l_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - struct device_node *child; unsigned int index; int ret; @@ -753,13 +752,11 @@ static int rzg2l_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; index = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = rzg2l_dt_subnode_to_map(pctldev, child, np, map, num_maps, &index); - if (ret < 0) { - of_node_put(child); + if (ret < 0) goto done; - } } if (*num_maps == 0) { diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c index 4b2f107824fe..e1b4203c66c6 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c @@ -404,7 +404,6 @@ static int rzn1_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned int *num_maps) { - struct device_node *child; int ret; *map = NULL; @@ -414,12 +413,10 @@ static int rzn1_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret < 0) return ret; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = rzn1_dt_node_to_map_one(pctldev, child, map, num_maps); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } } return 0; @@ -760,7 +757,6 @@ static int rzn1_pinctrl_parse_functions(struct device_node *np, { struct rzn1_pmx_func *func; struct rzn1_pin_group *grp; - struct device_node *child; unsigned int i = 0; int ret; @@ -793,15 +789,13 @@ static int rzn1_pinctrl_parse_functions(struct device_node *np, ipctl->ngroups++; } - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { func->groups[i] = child->name; grp = &ipctl->groups[ipctl->ngroups]; grp->func = func->name; ret = rzn1_pinctrl_parse_groups(child, grp, ipctl); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } i++; ipctl->ngroups++; } @@ -816,7 +810,6 @@ static int rzn1_pinctrl_probe_dt(struct platform_device *pdev, struct rzn1_pinctrl *ipctl) { struct device_node *np = pdev->dev.of_node; - struct device_node *child; unsigned int maxgroups = 0; unsigned int i = 0; int nfuncs = 0; @@ -834,7 +827,7 @@ static int rzn1_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; ipctl->ngroups = 0; - for_each_child_of_node(np, child) + for_each_child_of_node_scoped(np, child) maxgroups += rzn1_pinctrl_count_function_groups(child); ipctl->groups = devm_kmalloc_array(&pdev->dev, @@ -844,12 +837,10 @@ static int rzn1_pinctrl_probe_dt(struct platform_device *pdev, if (!ipctl->groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = rzn1_pinctrl_parse_functions(child, ipctl, i++); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } } return 0; diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c index 0767a5ac23e0..0cae5472ac67 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c +++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c @@ -388,7 +388,6 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { struct rzv2m_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); - struct device_node *child; unsigned int index; int ret; @@ -396,13 +395,11 @@ static int rzv2m_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; index = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = rzv2m_dt_subnode_to_map(pctldev, child, np, map, num_maps, &index); - if (ret < 0) { - of_node_put(child); + if (ret < 0) goto done; - } } if (*num_maps == 0) { diff --git a/drivers/pinctrl/renesas/pinctrl.c b/drivers/pinctrl/renesas/pinctrl.c index 4d9d58fc1356..03e9bdbc82b9 100644 --- a/drivers/pinctrl/renesas/pinctrl.c +++ b/drivers/pinctrl/renesas/pinctrl.c @@ -241,7 +241,6 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev, { struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); struct device *dev = pmx->pfc->dev; - struct device_node *child; unsigned int index; int ret; @@ -249,13 +248,11 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; index = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = sh_pfc_dt_subnode_to_map(pctldev, child, map, num_maps, &index); - if (ret < 0) { - of_node_put(child); + if (ret < 0) goto done; - } } /* If no mapping has been found in child nodes try the config node. */ From patchwork Sat May 4 13:20:06 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: 13653967 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 207F7C4345F for ; Sat, 4 May 2024 13:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 07534C4AF18; Sat, 4 May 2024 13:14:38 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2085.outbound.protection.outlook.com [40.107.22.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 5FE78C072AA; Sat, 4 May 2024 13:14:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 5FE78C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fWXn+HNPyiNYRoDQDcAcXp4xArKAw/y8SFe/oayt6TItkT60kYUvZw3LsUO5+w8cIdM28YEM0q3jSoDZjWtLjKH1vMktTx9G+Rp5tw8tG12E6+Jkd1fCM9BArtum/H5wgxpfn1Bb95X/Ews/RyLiMruVN8cDELzVsEVzY1UZR7wDnWfqeWkTRZsRQul+UTPmSVatWS6CuqONLusUSbHNXhVzqEp9DU8Jpng59kI0wbZ+aka+RHpz8K7LuIDqhqXDn7JAlA+XA8ctk8Rejq5LcG4LSEBMHd/ol1CU6A6CLYrBkyC1MCdthm5B6uK6B7xi9RiEmCOL7f4rpMLgcjOnng== 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=epf4L/dpti+hg620NqhC5qYH7xMXGAi+pTHVtvEELiU=; b=AW82+A8IJYGHbQJto/aGxXBevTqLMwgnJF8ET8BsnuEFzN9iskxYO6ib6PxRmfaZWPiWt+n7+enL4Qs1oUPPHwzPF1+IRaClEHwU23lvKPCVfhAMYmdw+FVBMlmjAwgWulJcaoSsBR6Km8JFlf2uVzuu7QM8GYd2DQ3zFM832wieBJatzEggMThrR7I4RlTruCweTk3JYo2qhhEAjP59J+lNCok7UKn5smB2TedoHc+hkW6nd0R5dqf42vkE5U7Xj1B0UMBl8jxKKFgS8AURB2VnJwOhyz2TPbFrjS1u/vt8ZpXUjNbcRJHiu5uloSUKjJAVtMndf/iI34wVaebWSA== 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=epf4L/dpti+hg620NqhC5qYH7xMXGAi+pTHVtvEELiU=; b=Dj+fXKXOBD1vI5VZVLaZnuBzZPwOSlnDkyrIq5Iit8VQPl/2J45TnEi8RICFxnOSUXd56kwto8odRlP5WmKXOXHlN4n/sHVH7BL856t0WxL5kawMYOTMcVZNHJ10JhXQq8plNmxx/hBcrYzNdjuJ6B0Oi//pM+j3bXhvDZtgjOQ= 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:33 +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:33 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:06 +0800 Subject: [PATCH v2 08/20] pinctrl: st: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-8-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=3917; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=WkwqgZKiLgnl2jfID+Ud31pueZUfzLGyRuwnbdcTMcE=; b=54q7MBEBsmgWVOdKQelInf02EJz/WtXPNBQuDk5mK2LcLLCBCOXVl32net6pxq9g8cBTu/cs8 PgTb3cxhzI5C/dbPij4nnc9A51CT7/Xx+UEJuEZwAX3+3Z+P3Zwv4ES 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: 9f5ee1a4-bb1a-48ca-a0c5-08dc6c3c23c6 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?vwHuJMt8Ffbi6PRESJzDXsfTj8E09D5?= =?utf-8?q?wuSwXM2DPZRymozjIq++7nQX5AkikCexm9GTSzOd4LrwaAAMLrZFrL5935LZoImjq?= =?utf-8?q?O5DKOp98g413HKrojle04QWj1VcD+/ptfQOgY9BvyxfHxskDeQnjFBf+cx3j94G0W?= =?utf-8?q?X73Dw94zJcBpVVgP4ErzLNojtQHkm0cFKONQEUNOGlJ2do5MNRJGGDf1JpVleDfC2?= =?utf-8?q?Fr3vIWiRodwhUa2n1xXMqDwi1g0smnM6Vif+yq5KuNo6RnuXk4OYQxcHjRDkPp0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D?= =?utf-8?q?kap6cTGm1h7houXGGgNIHYKeD4LNVQA1d76nOIBIFcyowmRvNqGnLxCeLmyAT6h3W?= =?utf-8?q?UZMyuY7OnTJhSxvUs1jDeVXU2yYcgFbgc4nihftCjd1fl37Xvq36obIkG2+EfuD8M?= =?utf-8?q?B/65AYy5tYVI/MDunytDjelFG7iO47a6QAQMfnjcLCWggrfmndhlPIQc=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?GaDTlf5kEvRtKnAhRNgLca6eZdP1?= =?utf-8?q?0uINzJw7I1eFH1b+6a0255OiPAnvegtov22d42A6bm1hE8NsgXmHjGjjPnFKQTAFO?= =?utf-8?q?qOVwwUYtBcOJcO6rLN1SJBUYEbgx/lU4T84tF024Xjp7KAqsLzbN5VEAddP0DtCis?= =?utf-8?q?g3g1lgzQoJWDbNP8jg/iD1LwPzgHfRA03m1/Yo9Km04GJnlqOEWqXnddS+Qd722cm?= =?utf-8?q?Qb925Z2E6xKW0Dvt/fUNdZwIpAsJVHlwRC/GXLx/VB5XdHVRWl17fR5sCwxlqq4k+?= =?utf-8?q?5F20vKRCmUI/nd33sk99aKGFIIUyMT4BWimDahYHq9VgvjCkOex85ETYAKHEy18uh?= =?utf-8?q?U1ScF/iLgdBd+Irpm3W24wpC1z+47CR/LxD9vL/2N3J/obfLrfEsaMMfZhbLWjGfj?= =?utf-8?q?idJk7Qi8MhfZjQT3fUmYWP9OFzB7uOpN1LwdRGDte7YxKtmHyrsduopSnzifaresl?= =?utf-8?q?Ay1QKIrV1DRl6JmzEhzPuMuxMLOwQtPjsMtNfvmwJUmq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fyO3kaVIejRKNBPpsF?= =?utf-8?q?7QVmcM8zeX4Ti5uJr73NH/iMF0dtrKMd6adFbeMh0BRbOK6R74Q8jJgvWka1+HJxJ?= =?utf-8?q?csrSd5msLmssklpKDX8WPn+ollzIf7JRUz6CxJHjUInvULH7+aTOeQ/3zzyoUuSI3?= =?utf-8?q?gnMabyiQmTmK?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f5ee1a4-bb1a-48ca-a0c5-08dc6c3c23c6 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:33.4684 (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: cffexWyhFxcbCs7yVHPCRoKq8Hz6oeRtownJutulL+N/e5mtXIytW8fqu18Jm+yYgRBqEfJGqV/mzLUkkQYPDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Reviewed-by: Patrice Chotard --- drivers/pinctrl/pinctrl-st.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 5d9abd6547d0..fe2d52e434db 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -1195,10 +1195,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np, struct property *pp; struct device *dev = info->dev; struct st_pinconf *conf; - struct device_node *pins; + struct device_node *pins __free(device_node) = NULL; phandle bank; unsigned int offset; - int i = 0, npins = 0, nr_props, ret = 0; + int i = 0, npins = 0, nr_props; pins = of_get_child_by_name(np, "st,pins"); if (!pins) @@ -1213,8 +1213,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np, npins++; } else { pr_warn("Invalid st,pins in %pOFn node\n", np); - ret = -EINVAL; - goto out_put_node; + return -EINVAL; } } @@ -1223,10 +1222,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, grp->pins = devm_kcalloc(dev, npins, sizeof(*grp->pins), GFP_KERNEL); grp->pin_conf = devm_kcalloc(dev, npins, sizeof(*grp->pin_conf), GFP_KERNEL); - if (!grp->pins || !grp->pin_conf) { - ret = -ENOMEM; - goto out_put_node; - } + if (!grp->pins || !grp->pin_conf) + return -ENOMEM; /* */ for_each_property_of_node(pins, pp) { @@ -1260,17 +1257,13 @@ static int st_pctl_dt_parse_groups(struct device_node *np, i++; } -out_put_node: - of_node_put(pins); - - return ret; + return 0; } static int st_pctl_parse_functions(struct device_node *np, struct st_pinctrl *info, u32 index, int *grp_index) { struct device *dev = info->dev; - struct device_node *child; struct st_pmx_func *func; struct st_pctl_group *grp; int ret, i; @@ -1285,15 +1278,13 @@ static int st_pctl_parse_functions(struct device_node *np, return -ENOMEM; i = 0; - 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]; *grp_index += 1; ret = st_pctl_dt_parse_groups(child, grp, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } dev_info(dev, "Function[%d\t name:%s,\tgroups:%d]\n", index, func->name, func->ngroups); @@ -1601,7 +1592,6 @@ static int st_pctl_probe_dt(struct platform_device *pdev, int i = 0, j = 0, k = 0, bank; struct pinctrl_pin_desc *pdesc; struct device_node *np = dev->of_node; - struct device_node *child; int grp_index = 0; int irq = 0; @@ -1646,25 +1636,21 @@ static int st_pctl_probe_dt(struct platform_device *pdev, pctl_desc->pins = pdesc; bank = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (of_property_read_bool(child, "gpio-controller")) { const char *bank_name = NULL; char **pin_names; ret = st_gpiolib_register_bank(info, bank, child); - if (ret) { - of_node_put(child); + if (ret) return ret; - } k = info->banks[bank].range.pin_base; bank_name = info->banks[bank].range.name; pin_names = devm_kasprintf_strarray(dev, bank_name, ST_GPIO_PINS_PER_BANK); - if (IS_ERR(pin_names)) { - of_node_put(child); + if (IS_ERR(pin_names)) return PTR_ERR(pin_names); - } for (j = 0; j < ST_GPIO_PINS_PER_BANK; j++, k++) { pdesc->number = k; @@ -1678,7 +1664,6 @@ static int st_pctl_probe_dt(struct platform_device *pdev, i++, &grp_index); if (ret) { dev_err(dev, "No functions found.\n"); - of_node_put(child); return ret; } } 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: 13653968 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7E1BDC4345F for ; Sat, 4 May 2024 13:14:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 6600BC072AA; Sat, 4 May 2024 13:14:56 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2059.outbound.protection.outlook.com [40.107.22.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 0BDDAC32789; Sat, 4 May 2024 13:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 0BDDAC32789 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com 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> List-Id: 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) 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?= =?utf-8?q?2QQk7+0QMHPIpTBldZRAJdolSq1ArxXKnA7GLOHKdTKEynqCU0dpKUiVRNQPyNwCa?= =?utf-8?q?iRgQQBVhDgDHhH75hLEqRft2ZYdPQSHttBQQf9er9aolY+ynQ5dunGPbLYdAHFB97?= =?utf-8?q?K/ffbrc9IDOaHw416VNeOWWKjZ3cLVyNvJRxVIuIheoYAERvcUXfGMvJyyPxfCm0j?= =?utf-8?q?BoKYhjJW/NBNzIuLahhDo8qlbUkuJCIU1AVwXFc9JjscWMlK4ApkS7ImhmLFbU4UH?= =?utf-8?q?P6YNKYiT78FCZctcd/ev83qpuorOf1MiKcfGnmN5y6pF2vzD4Ddw7SvQyAp1G07n5?= =?utf-8?q?mgQL5qax3geyCi8GQvLIr1eEoH+vpTAUBkwR6aHqaDCREn10C+6wOERKFlkuqpgzL?= =?utf-8?q?NaHgID2jI5CXjNwE602ByZduYOWBK2e7U+n7v52o5Z9hqEZHiLoJTgV27EYMPT92I?= =?utf-8?q?UDElP8+VZQKs3+o2ZZm2HovGvORwg3UKbjeHzJzUNDLuUse+M9gGfDQoQDDvxssXx?= =?utf-8?q?4KQCxwfdER0Vh+DRb3SyfnWM4qOjhzpcAqxqI4+/F6n8Hgw5NMIUB2fhJFHoIyeON?= =?utf-8?q?+75ZeHWCnKRx1SORZSFz35Ta0hhXNzy3dFXRbbeH25+5uHV8S/cBYG0xu8DSAhVaU?= =?utf-8?q?cS7fmE0TTLhIXENVg5y7IJwUXpyyvie5MG7r4UAVF3r/yfvgni8X2OW05Sz6CICIa?= =?utf-8?q?hxhp/J9v3madM4k/t9FHWhPDvhpZQE72sbS0O5T/lobuZmkxE4B+Jh++gm0BIkTl5?= =?utf-8?q?r1WK/qrc2jx0lNWy3nHO1KHTtrfpyexYe2pfL0McrT7R6SY4dcRDFjGMOQFDO1mTJ?= =?utf-8?q?oiADZgbgG6tVjz4keXpvCQSl+Xs6ea/z0gw=3D=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?36cOR1ddfY9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= =?utf-8?q?6YzgV75GbTwPVFWp9yiOhbl7ozYeEJ26ahVq4lLjBK1Bv6pawcoU+IpEVmaaWyscb?= =?utf-8?q?8OKJJqLfy0OJP45ef2xcZGCx3DeQgIhJcYZkGnsW+1r44yv51DisbUMElSFezIh3S?= =?utf-8?q?4ahXVDReddp5XjJmxMDvrbfytFUttlQgwspQjSZVhv61U1nI0GxA5aUvaBAwxEaaU?= =?utf-8?q?n+rRnhfNxBRSMU/ZLMrFxXa/xzAfo8aeUjN64KbBzCCZTFF5ncPUM2wu3HE3BSa9y?= =?utf-8?q?ZYGw6TuLCnbAenSUrQkOPX5aEtFvfZ4fWruSiBTdOji5Si6xdyTS0OAutpN3OAXs9?= =?utf-8?q?+HrRJeiw52Bb36CHi8Q2eFmdAF/8wIGcFQq0mrAtu8tqfZmDpWAzPYkuoxtXwMjwY?= =?utf-8?q?sckbVkubXblLEr/gAkkwq4THCrTtktJLokTWxKfBG6+u+FoWRD8P5SBZNWcvSiOvo?= =?utf-8?q?KJouMXaHVpHOeFGcKLW/+8jm8N7FdwjKedsWEPLrTK/+WprdLa42PVcaW2oR+fyW+?= =?utf-8?q?JkYnr0VFFrjZyznFYjbMpqaxiS4MzsXKA7BgmoL5vm4XZZBnX68e0DwDCbQBbFkhL?= =?utf-8?q?aSY5swNKBexQ1GcNFNQqB81AngHhzt6BkvkXxTkvEA+jL/FBBypSdr0YO6Zl9Z+lJ?= =?utf-8?q?a766eYq/7Cgv?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6db9388f-6ac2-4d97-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; } } From patchwork Sat May 4 13:20:08 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: 13653969 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A4214C4345F for ; Sat, 4 May 2024 13:15:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 8B913C4AF14; Sat, 4 May 2024 13:15:11 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2055.outbound.protection.outlook.com [40.107.22.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id F0B82C32789; Sat, 4 May 2024 13:15:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org F0B82C32789 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWcs9F6D1cAInFj0HNId55OgFiP/mkBRJdDBth1QPgZ5CaKgqIAALcgcQA1NjWptsksyVAzXuhsB3we/2egExl9uYbbVtaxdsq0leD3umqoNBu+9Ccxb8izBxX0JQ5w2zPGyFCIG9XcR9h6EXqpY9B2EPYkqz1V/CygsdPAe63ZvpD3Dk8JuG9HlU5X2ruOSETUaCKiZQEW253cf5Cl9oHzq5xhhjeYZR33/Siq5yx3CO9DxCQUZN4xP9Uos93z0tmyzcRg52dcbHPDW2YDrx6viOehHk+dnvXdGsJS7iqL209vw/qHQhIAGk6ML/9vKar82r7wkfCYgoO50+FPaUA== 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=RKzscdFMbKHIkbo5TBU/zyPoN0zmGs6d6fVNhcTfxjo=; b=h5aiCFA3yIhGGeDVFZp9kTNSwyd475ryEOK/SwQEGNwyuf8nAUKXiAKpeWOtGrkrG/DAkGmwU0FmaxJJ/Qh1ToPDh8oAQCYFNqzdxmG4x4XkI+CnQsToa3zZzW0z+Y/5kqztve3wax35JxlgJWPRQn4Cj1p84j2V3kd47RIp/pQr40bX/BY68ySZ4z7ZxdMDbCFd8EbpPEOLzCm4qeSjfrQeVc2esgF6218qpIGtcad4RckxyhOxOnng93HiR+/Vm/o3J5TAJEiDNV0Jwip3eEaq6gcIi1RI6108Cm7yMH84PCPm3puWCkSFF3Q7LIEUKhJ6cEUQ7cK9iu1lQSsOPg== 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=RKzscdFMbKHIkbo5TBU/zyPoN0zmGs6d6fVNhcTfxjo=; b=lZr7eJvKLCQzJZDvJgt7Naxc5QoUcJvqDpm0lF9CZdP2zjbsNCbQcGc2VU0uaTeQ1RX0b3Mq05FEoza+cTb1C87bIBo7Ud/6+Gotll2gHMQo0KA/svrXB2TElm9iznEQIx28QiSe8Fzb0dRRnqVsvZ9l0QoJ7H4RinW3AYeTC4k= 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:07 +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:07 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:08 +0800 Subject: [PATCH v2 10/20] pinctrl: equilibrium: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-10-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=3196; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=HA5FdeU3k8hXGIzvGdYVmDetKxvVIH+CQmWTQZMAMaY=; b=5/9X9Qk9v/w+LR87FogVZNrWJ/LbCFJXvedVd7p6cKDdq763RoRF3HqVmtqSayI+ZxqnUpTVv 9nppgP1puY4C3uChQOu864GCcusz2Mno4rh5TLaHidULc7StN8ugZY1 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: e5a5311e-56df-4041-119b-08dc6c3c37ca 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?+e2HdoprGVrzXrmOHx/a9GV3vTDOPXH?= =?utf-8?q?Zdz6s7oS2f+/3S7ypA7czwD0e7r4deU+DWrrBqaDsAMxOzpVpqtlnNtAIz9L//lSw?= =?utf-8?q?jjNq4tOt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9TOQJvXXxBE2fZulXTzR4PysKhngJC/ijBao8nNtNQKsPN?= =?utf-8?q?akjCRFmWYQgH499ViKOOJH5baNoklHeqhrH1Izjax+ZCLARVTsfWoy40sM37rQUxi?= =?utf-8?q?jBeiFwmxqQMLcR0bA5f3QSEfLxIosmhk0a1QcTnyOXseegcPnjGA3jNg+Wjryu13G?= =?utf-8?q?J/ct69BXAlPRaxvma+0X1oGamWEq1h4ADZMunmeuQBDVb+4ZGkFkO0mrT5D9wTCtJ?= =?utf-8?q?klWiLKgVg/qt4dL2GzkuyTPpQHgxRNKVIdhu11cvI0JklQamB4HoBxZeVyvyeXJYs?= =?utf-8?q?w/flVMiLPDo/DQfeo9mZEu9B7LC9bIlEV3yco77GgnAwjjydpT+PXlH4=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?188QvLyzi8N8AubEdh+Jr2QYA6uS?= =?utf-8?q?f9m7n7AMlXqW2RPxpbqfdFqSv3hqKvNMKJdy+Gn4oOi/sq7N0T9l6xBI4obziRTv/?= =?utf-8?q?Nhqmsfp4VWzxmuOY2VdLUA3hO9WdpYBcn/y6xWdroq9O4RGs7WOmEF22MndyPG1b+?= =?utf-8?q?mspjEBltzQExwSPXsLXwtgy3gqzNrnvBxQux06D0GnADYY52ST+xhflF8hrrsyqdV?= =?utf-8?q?CWaBTywTJwzhtf+sYryKxmnJTOA/A21uWZ6t2Q704WQhx/MbGwbZ9HUn761lvGA+f?= =?utf-8?q?dekB77d+FxH5WfXbLSgB+if8HuaMASlmjZB94QDR8nhFCYX6Gbiv5Am+jwwUrJEFE?= =?utf-8?q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?nPrBQFhkPN+PLSM7To8BIULYvl5Z44V3rvm1V4BTXfGr4XZK1xaOuqywne89ZnOkU?= =?utf-8?q?NYa/51EquR/Nti4/QQf4HlPxI+VZmf67kwSdnQIaZ8NkgnIl0tOA+vX36LWR4rF0W?= =?utf-8?q?ZLkNzBy9rKVR94paHVsBRW85jIZgeUQ0AFXNR5i4TxAH81ZENcwCUwV9TxTbld5wR?= =?utf-8?q?ikth5PXPTcFXr7FMI1MvPfu4Axa4U8ddGZ0aOgtq4zSrqobFZIboNYPzQcezDUaKH?= =?utf-8?q?fJd+Q24BbrT8kbwqbelZwhDHRTnRc4K0SOWnEA1OnFIW+hmGnjdzMpG+xFD7kktKN?= =?utf-8?q?64Yq6XoGt67O?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5a5311e-56df-4041-119b-08dc6c3c37ca 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:07.0565 (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: tgqzsjFOhmoOiJr4CQutCoVr54qf+mNdPaAiocqwbFYANx50RD96f41YT+/5iD2RuPK65b/qDDXMDb1ZrTn3Ng== 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-equilibrium.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index 6e1be38865c3..e727257bb697 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -588,14 +588,13 @@ static int funcs_utils(struct device *dev, struct eqbr_pmx_func *funcs, unsigned int *nr_funcs, funcs_util_ops op) { struct device_node *node = dev->of_node; - struct device_node *np; struct property *prop; const char *fn_name; unsigned int fid; int i, j; i = 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { prop = of_find_property(np, "groups", NULL); if (!prop) continue; @@ -633,7 +632,6 @@ static int funcs_utils(struct device *dev, struct eqbr_pmx_func *funcs, break; default: - of_node_put(np); return -EINVAL; } i++; @@ -706,11 +704,10 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) struct device_node *node = dev->of_node; unsigned int *pins, *pinmux, pin_id, pinmux_id; struct pingroup group, *grp = &group; - struct device_node *np; struct property *prop; int j, err; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { prop = of_find_property(np, "groups", NULL); if (!prop) continue; @@ -718,42 +715,35 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) err = of_property_count_u32_elems(np, "pins"); if (err < 0) { dev_err(dev, "No pins in the group: %s\n", prop->name); - of_node_put(np); return err; } grp->npins = err; grp->name = prop->value; pins = devm_kcalloc(dev, grp->npins, sizeof(*pins), GFP_KERNEL); - if (!pins) { - of_node_put(np); + if (!pins) return -ENOMEM; - } + grp->pins = pins; pinmux = devm_kcalloc(dev, grp->npins, sizeof(*pinmux), GFP_KERNEL); - if (!pinmux) { - of_node_put(np); + if (!pinmux) return -ENOMEM; - } for (j = 0; j < grp->npins; j++) { if (of_property_read_u32_index(np, "pins", j, &pin_id)) { dev_err(dev, "Group %s: Read intel pins id failed\n", grp->name); - of_node_put(np); return -EINVAL; } if (pin_id >= drvdata->pctl_desc.npins) { dev_err(dev, "Group %s: Invalid pin ID, idx: %d, pin %u\n", grp->name, j, pin_id); - of_node_put(np); return -EINVAL; } pins[j] = pin_id; if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) { dev_err(dev, "Group %s: Read intel pinmux id failed\n", grp->name); - of_node_put(np); return -EINVAL; } pinmux[j] = pinmux_id; @@ -764,7 +754,6 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) pinmux); if (err < 0) { dev_err(dev, "Failed to register group %s\n", grp->name); - of_node_put(np); return err; } memset(&group, 0, sizeof(group)); 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: 13653970 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2C63FC4345F for ; Sat, 4 May 2024 13:15:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 1CDE8C072AA; Sat, 4 May 2024 13:15:29 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2061.outbound.protection.outlook.com [40.107.22.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id CCCE0C4AF18; Sat, 4 May 2024 13:15:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org CCCE0C4AF18 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com 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> List-Id: 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=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/tibdjq7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IC?= =?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 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; From patchwork Sat May 4 13:20:10 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: 13653971 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 019B1C4345F for ; Sat, 4 May 2024 13:15:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id E7207C4AF18; Sat, 4 May 2024 13:15:44 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2067.outbound.protection.outlook.com [40.107.22.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 66675C072AA; Sat, 4 May 2024 13:15:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 66675C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W13wp9FiM++nWc+Yz28yg2bbPZLLdw+WTg1bDgGDy97n7my34QTBMGJm9rCBvzp1jMM40UEGyYOCjXD0zS8w/4qkYpLKQvl7qMriD27ylLz18r1NRpGpx71+GEwMlRijcmKKUhs+CFXmH3G9kKcmBss3HTxz6j5/wfn2/ZkDbfipOOFZwJudnMiD2ird4Hc/j/vk2HMY4xe4rTH60RivfIHTmI/7r/gxMu5AU+cvfzkbp3oXgi+gdfEF2NaAknoNou+/0PzqNZ5+f40vNXUDVNCCLF71gCdSTz7Sj63iiXWC0PUSOU1MYg18Pk0DfHCpTkaY8eI6SEW49xo2CPrxGQ== 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=EhXMCkb8gOkREMgpBl9dMK0MTGtMhyMCwsI/DCmdxXmz2BiDju4e0MARf+kdgnef3ekgtf/sA9wJjhLkLd6Woccc6Qi0oJ9qXs7HxQ4XHHn9TeSdhapuG31Hto5GwfCrDrrSFI74qAb7guux+hptHu8hvQZKzhaSYIDPhsgyorjn8xKgNNXFlwfRhwKyWTt7SG6vfhYriDHOeo0SOkJBpHhlAi6OWt4yqsUYKvHFcL4PAVylfJghDn6Pv8pNNg/UwTdNciF4jQVyFOU6oSCDIwWY4aCHM1nfV3820Dw/nCDJc4Pwz1nHR6zgMJtCOq8jckdo093BlwodHwDiJ8gSQg== 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=ikUa133ScwGjkZxB3mOk8JOHeMMaVQC05IL6z7ifMBDxhZikG5oDN5sD5QpBRr4tLPYGOACUrjCuJdwC44Z297sorvsDzH3xZIa//z39u4jVbrh6HxrLaD6DnCKoTP5EFf6x/zLkmrhHCBDTN7wVZUv4UsoaReDqBrH4StYeQPY= 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:40 +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:40 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:10 +0800 Subject: [PATCH v2 12/20] pinctrl: s32cc: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-12-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=2925; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DE1TsODFhZuLZm6pDc3wReEJgqgWx9DxsgygoDyK3OE=; b=4lPD+sR8+ZJDBmnUSGc4BiJR63BC+fsZ9sA6ZLC22ieCU5l/dWZtPjTnnXlLTXwDaVFM8DgGy HeQBDCN8beEC267VymO0c1EOJ0IkKry6T9AQEMkG8hUVyAvlluXu2Hk 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: 0b200d19-f7e4-46c0-a449-08dc6c3c4bba 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?xHLPHeyT9tsHhS/evDi8fZCDww+tj4u?= =?utf-8?q?to1HTTholAYP727rq2DdxLNgkcqFi/59blmwxIz6/BOvXWPV2ycpDCQm1xSK+Iq8D?= =?utf-8?q?X+DYcCDjvLJAMsgQUMWKczcHRzXcdej1jWL7i8pQpw3JfFtUafohOXft7RHp8daWq?= =?utf-8?q?jpbyZqUFePUkOTtUoLNNx1iXi44Kx5Ea0Z4+fSSgJl2vY7oTgz+buDy0hxeiw20mJ?= =?utf-8?q?ybXGouUnbH09g5jMdDaJTvCumbHu791ts/6LS3CUYWw8jm7qImXg32udowtaLQINW?= =?utf-8?q?5s2crBuYFbm4gNEA2gs+hLKDS1LBvg29YQgLZry4/0X11kd3kKfMKRvk6M0+yMrRf?= =?utf-8?q?u2ZSDT7nE467vpHo/tJQYhvsctb2lAOCJpmHNIDYpt3wXcZ8dZ4/RoTaq20Y/b2Qx?= =?utf-8?q?1wdsiqkNzyfUQUQsDMZNFHmwceE92+WsRBqwWrlng7kokqdz5CuC/+Cjz/e+9yCqq?= =?utf-8?q?BXoAH9IELCPW5k8KIWXqbn1cvc2FAa/ERdh+YOs7vm12omD4YcOXqSV3ySF8s6CqR?= =?utf-8?q?EteB4hZ4y4HZkI1G5+f0Qpy82OFqU0ZStdtxLgy6t+vLwW5E9gLlzUwxEFqJiuGyV?= =?utf-8?q?J9J6TlemQv+b7qV8QWQGDtbwOyVcY6NsJDnFdrZlDQzwAxia4VHedEADpWjGiKdka?= =?utf-8?q?1Nf4aJ/Wx/NNxVQXjeRivVqYNGW80WbOcscRN4SW6i7lEKeIfve69FTNhXMRl1g0I?= =?utf-8?q?0lex4fhywfo9CE4kODl08TzY5WgPf5o+21LFeCPpxD04HCF+bMkoUXjw8wWxb1o4P?= =?utf-8?q?AI0g6AgJ2R2K0/ZGl9w9i2QZibY7c1G+nXVA0R2k6YupCEP/Md6mI2sq0TTzEPMZv?= =?utf-8?q?L+LlLEkxGjS8P2fme60dUeUehoblHGJ3zxrjKkrxV55cPnM/a3NZja3JFCPcpeUR9?= =?utf-8?q?iotLGUTy2AEVMy7dSMHhb+2t7FZn4Q/uKMvaP7cVvobgPQgH88SLoiQHdsOvIBIjW?= =?utf-8?q?pJBXya9xbZsgFoRKwLck9jtVWPRnhkOccfjqPmMgfwHVKwfcznI+0idJCyqJfBZll?= =?utf-8?q?8K1J4IyzS8Ab5dPW9Rp918kZ20KdejwJ/d2VkL4WzJgzJ5M/4Y3Hu8WuT0TI8z2FP?= =?utf-8?q?0MJlr3NZS+WvP0lq8jH1FQlOOkOCq1zpSXTDm/ATzYikKmyW46qUkYLEdkadoRiuL?= =?utf-8?q?N0vZ3Tc6RgZTqWVr7QpzwIdoABFURuO/zzA0XyXDD5t0sAW8mrEjmmdOlMgvB9QlR?= =?utf-8?q?rdgxgfZBBXtsM88lRSfwClo7L44k/K9O+JwmNkdiqfB83hNugG9noEQf6tnoHOmPH?= =?utf-8?q?a1MXLxfOsewzQEVcIIGLgRsGUyWyLAPOzeLd8VCUWsMPdczJRUT9D+Qo=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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K5dnuSodpVa0m7E?= =?utf-8?q?sMcjeVYkw6ZWjC9jSk1o1a/pQnY3NZs2KDTqQRfdig/OYDQuyx9FqgWDJQih3YuUZ?= =?utf-8?q?KQ1AKwaiN3JkP9oDFuTaB+Uv+IKbAinY0ffRFvUKjGmaJ6IJIU4NL2ROYLfIA1Lpd?= =?utf-8?q?ER9QMd+0i6XK5Qtpd93p9sYvfqAksJd2XZyZ4jQ9zsCXzot7WyZiEjQajqvsI8DyR?= =?utf-8?q?y1DVInfFU6KeeHUbol9fPsqO4bS6901Vffqm+fGEgjaQIjvqW8hZ4vj2vGXeo5FRr?= =?utf-8?q?3yd0RUe2e3ppQCKSfXMO8HlqK/iAjBpBLWHxJ8mP5J5eE7gtjppgSVQjirfB5vHAj?= =?utf-8?q?n4FT7kjS9UOKr9EtG1UB+7Wcj/TFFQxnXPt0wMV2rdtucTXdQR2FNQxJEz016HwIB?= =?utf-8?q?+1AAL+0sv/w8SdfzXlVcdU/uzT5qDz0VZDINQ2aY9eIgxcxdh0loY+Oe9woI2HGd8?= =?utf-8?q?yJ56/ZBEBZGwiAoM6pdjQCTxfwz4pGiedZLPBQ07tek1dJ0R6mary9u0JrXRgs1gu?= =?utf-8?q?kzgSqvBxh+y8U1YBiujR15seBLFzV4/7whYjtpyTnS6w+YH7IZTWF+bHbc1t5M0BD?= =?utf-8?q?+l65BqOAE4sa3LZU92hdtX6giVbKnhZxvJbq4mHT4Q9AI9SmnaX+vfyGxGNZKkduz?= =?utf-8?q?NzMELAK2Gje/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b200d19-f7e4-46c0-a449-08dc6c3c4bba 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:40.5200 (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: kTB7cM73P9h5jqKaR9YGbwVTQwji2+xZXBGT2FJE8I8Ox6V09qZ1W0fqCU0ax8qp0sCNCd/aXZ64mGZHFKS8kQ== 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/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; From patchwork Sat May 4 13:20:11 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: 13653972 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6032CC25B4F for ; Sat, 4 May 2024 13:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 50BA7C4AF19; Sat, 4 May 2024 13:16:01 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2048.outbound.protection.outlook.com [40.107.22.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id F1023C072AA; Sat, 4 May 2024 13:15:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org F1023C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lee+JnAzlNvpehCxhyFAeNpuVgBeieK0ADvhiJEQqhD5hrggv2Iv+0N7RubufUMVytEBTc5Z3PorTPlZQzy4on0VDWXW5O3GGi3eunGf6u8W07OKRiaMybHa6Y5gjwlJYyrivI/aFHaQEEl1THvLGBgUKsxK4PrZs60drZ4aXox2/BTK5RdlHZHofGyMOfeHw4o8PvmTQtHPWcgZDJj2Wez3FtOLBNsbl4ywsj56D3xzm8hci8kdUH5IhQqDFWLmpNNvF7UHiNdRzeDOf+t8JAxIolN9NrEYKsLnNqbQIAL2fhW83h4X9KoENDLEtBQvkFCAX3qmE9UBLfIEJxWzHA== 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=Wh46VIFFtnR87VP8CR7uMzRt81dfHvC2gK19Gu2CtGM=; b=aEj/6j9IjzSd7KybfPLL3ptJ9WKdL0PYHrUkCXghiSmDOzxXraYQqc4iO9uTppTMoEhk1KAyvoWlN5KXwB4yWjClQoH+Krx5fBgJQu4to/2epChjSQoMNZceMY5Qtn8g5tr1QyqXgiXLku2vHu5tIAZZfKqd+SxOQiZifaagg4eXRLTOTAplderools+hJbX+qAtUxX3mTmz/15yf9jvxk2ftcyEqsj3tA7ZiUhGew41dZIxE5wASVm+7bDyCCkG8SnwS489nBvEkIYHOyOKRn/uqHpqm+pfnxnXy9xmSr/8LOpPCi0GLgi5iUJuupPbEBXdHA2T7ytaQZO3HHeCsQ== 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=Wh46VIFFtnR87VP8CR7uMzRt81dfHvC2gK19Gu2CtGM=; b=EVS5HR5xT5AFA5dsCbKK5mnP37N6m8GiH3ZoMhDe710IfMnodKMRLnfDYtCYSuzrxxLvkKC47feDQoHmqZkUF4OUrFP3o18J6dUNoJmL/+ayPxkANvxAPQMDmIaKB70JBkCdxI3cANfhpsRHxTPMF//ttNGowaREPSakeoEQ0pw= 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:57 +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:57 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:11 +0800 Subject: [PATCH v2 13/20] pinctrl: nomadik: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-13-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1905; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=x+RKtlqeCysZbUAk0csydxI+b9I02cK4F7LOISGb+DM=; b=JE8/0bWFt0FhuoluAmwXD7cZ1NKNXM1V4n4g+hFSwn0VVc4ZZ5ApyeZfiWy4V4lQKgKKWENdl 0jAfiJK0OOcCjOJmK2qZEUZh4Q54eqOAxtCinzihJGth/uc8xGvAO/J 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: b70a4f8e-bdcd-4b57-d0c5-08dc6c3c55ab 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?E5L+BUqm+vMSm39Frp2SuehsVN8rEIT?= =?utf-8?q?hY7ZMM01GEoGLC6k6YeX5XllaTW9jRcuSCWvIV2jtcWj9SeOyG3uDbG9WD5WCoxoR?= =?utf-8?q?AuzkyV2fRKS/Mb4GEwcNgMfSDLECcSw6zPLTwDwa78xT1QGWHul9deAvt2kI8gKUw?= =?utf-8?q?crxWDxv+E7kh0q01rjV9TO4H3fY98rzWyTlhepRuEXKaZ17I3bbUrig3/kW25W0BO?= =?utf-8?q?JJ2F4YLdIBenCI4lgQoscPaPaX4UrmFhN9rYnRGXyn3dHUf9vQN7MRtINa1pYAEfn?= =?utf-8?q?GgmI4kBBjrKsCQy8SkT1HY7Cfs/k6W8ZA7m7gHWQJPyPMN2zQxcLUhlBAL0SAUmVj?= =?utf-8?q?MA+T+j+f2ELxeNWqrPCdrQ214nVhOgb6fYEZkVlkRke/Mw8onWUI7tdKnIXu6RoQ9?= =?utf-8?q?xClTaL+WGsTIAa8LDfYjh5lwheWFKdomC9MbyaePkr3cLEYbjEuNCQUq1HzJTfvy8?= =?utf-8?q?G0Q7QAFz79NvlxdQILPYT+Z5aIG4FP8BOWBEmVRI+WFUIe0f/n0Q+I3Nw1Hz8Abq1?= =?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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?hQdK02yXQN/9HxCbZWmr3b4JRblo?= =?utf-8?q?c+RjuiwF8GSFTWRBfClDkRcNBD1io6ZDEvMjr7moX4b8c0QGuqWZcPWVLabsqoMyZ?= =?utf-8?q?aiLGMIPpTTf2kPjY82YrQ1d6zdl8Cu5w3Zl9UG6YgVMxGRB5qcYKHh5Kv4Bjxn9RK?= =?utf-8?q?YiYwrnTeEfxMoXamOyOXE1q8Ttp6V72R6qoFVfMkeeGfO0eRXxZS1mgULZ/4XItgw?= =?utf-8?q?oiCXZEgmChAHcM23AoSV/9CW9fVKvJ7vHTurKvJhOMiN2ieaDruuuwMPa7Inflmvf?= =?utf-8?q?IJP5GBKNooZ3thbeAUHbGmziJnLqzrjrn2RzZUrcdGNhZpz/iC1IyZ2oN/FWZrype?= =?utf-8?q?GV31Z8GOAkZ7wQac6ebGIO0zMXTMS+fo447SZ+uv58iZvzCoLC/d5yyt2PQJYpo1G?= =?utf-8?q?rgNxZb1Ygv833Q69SPTBaQTsX+nZh8GFuS2A35//hBTm6XvOwBB0+IoACfZy9XOLh?= =?utf-8?q?7yHtvPul90yHGMrHkMiXeFXGpqRhFCeAcQsWZ3RkaUfTEeEoepLr0GQFKfskK/f7u?= =?utf-8?q?wCvpE1cyWnezB3DjngW/R4afnWDr/UvOflmHUW4FicedbqdXA8OwXDpSujHYhoqdU?= =?utf-8?q?Ds4wKH7bAxyyYd7loQzdNo5apWxYeOwRJZIY44ZNZroA2KG6WpM+YkG2dK3C0XpbD?= =?utf-8?q?72RWnPZHZh9t+qtCXZ0kRy9lO6QfIpKFfCSABsuDfqnxEUQonx5Ran3TtGcSKyOxD?= =?utf-8?q?PxomnZsQ1rTx/h0sA+x8V5q7ZQ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-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:57.1871 (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: UNrCeNgMIYVy+8heMkCZBvq6g6j6oQC/D98TXd5g78WaLKxK+Hl3hAFwJCgy7l9LEl9URhHECQ/dXLSXji+JsA== 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/nomadik/pinctrl-abx500.c | 4 +--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index 80e3ac333136..47f62c89955a 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c @@ -811,19 +811,17 @@ static int abx500_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *num_maps) { unsigned reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = abx500_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; } } diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index cb0f0d5a5e45..fa78d5ecc685 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -804,19 +804,17 @@ static int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { unsigned int reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = nmk_pinctrl_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; } } From patchwork Sat May 4 13:20:12 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: 13653973 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F25EBC4345F for ; Sat, 4 May 2024 13:16:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id DAA28C4AF14; Sat, 4 May 2024 13:16:17 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2059.outbound.protection.outlook.com [40.107.22.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 9D4C9C072AA; Sat, 4 May 2024 13:16:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 9D4C9C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjpbylIYacvnbNTWQP2eW4n5I4okmE77Ce7/Dl53/EpW4Yt8DXzAzkFvYu8UldsRbkKqZPe3VissAU7I5jfJT18hYiGAWBsdEdnKWAxcBtPOxibb3Uvon5JFSTkptfPnOy+MOP4npnLPhRn2tEFbe5z65Iz2iDYrAswN+z3Z5vb9513kV3ldW2CqleJMF/LBMywB+tgrfD1sGL75xCez5X2jjrv89l0qKlBZxw7i97RzX9mJjN/K+2COUQuDVL5mt5yS5gJnHUTzAtbOU9tYZw1tgYgDMOiZnkfllE34U/j8XoJKG2jhVj2zCGCbLpe2KUyy0a7olcgT55PALcNERw== 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=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=dqGYH1FwLeN/qpMQsYJ0OBQXmLTP3aJUc7GzoCCWjyJrF2QvI0uVycx7CRkHbtc06SSQTJXmiPi98aUf8gG+JmiOsOJZce7M9pBhnCR5rJYGyI/FtQTsCJV3takHYFyBu5OvMG5wH+3DxvDvamud9A2R1+Q2Ji6fZKFaCngPDKCeNqgasKOdE43yAK2dV8QO6XxD96iLBsLPosTkRWwlHIfemLah8ppu6psxAyg1SCa9WNfgotSaU2gMDmZjVlSeqadnP3f6fEMXWOQ2EwK9OVhXs0rWjqLeX5R6xyLhkLhONee/sWVU+hrlwhz8XbRQi4V2NZ2Z+TyEchh4//yPTA== 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=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=LbykI/RZmuGK+O14E8wO67iqZNfdyu5EQnlofWQCNSbAHiStMpPWzUmxv9UiR5GbG2yCzkxFgz1NQ+IwIUW1ySOpuWD6sM2jl05iLgCGOtZjFpdDtSOXhpaDm8KRFQiOPoJLE8ZmlMC7w+DDbq97yjKsNdcQeIQlGxagDrmT7Ms= 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:16:13 +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:16:13 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:12 +0800 Subject: [PATCH v2 14/20] pinctrl: mediatek: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-14-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=2143; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=lm1PEdHATfoxwJUL9YMs41GxvVEK/pacMdZ5mWFlWX8=; b=d8MWpOtXKNnFGmfz1eHOooCE8YCLHVTyQNBBLhSiEJgr+86Or3+ekvXynCYNgOqJisw6NtlEy IWju/BxoMOfBW/IhPYIVChwIIYZ7T5qVjSiPvU1zknqEB2Ele8EoB2c 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: f321deef-96f6-48ee-0b73-08dc6c3c5f9b 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?sBBy3tH1CTnhRXWFHqlvHDLqUeEybf+?= =?utf-8?q?XjGP9ce2GEr9Al8EXo6mJ/Ft58KSY65O+yB/uG+Pq91MRMmANGWmKZ3gerg0vTesU?= =?utf-8?q?b5dmSi9W5sSSmv+C7NYdouGZh3Nz/j5PV3yonPw7A6y9LLZKdz/3Kkn+K1GoC7Fya?= =?utf-8?q?qpuzIsVUUROos0IDCDUjaXMl9Ld0foj5Q+ZGrRDKAixBt2Xq0Z9sxnc6ccCgSChvG?= =?utf-8?q?56M+LvVwuB6wOxDX3huE2SR/PLjBIR1AMRR66Y6R3wQ1aSPozN/60nWlF/IiyVgkN?= =?utf-8?q?6R8kAdm2rxYnNmWPdtKlUVFtTW1n1Qqr+4ylv2S0PrJmameQPNbw3wxy6K9dbeSTN?= =?utf-8?q?BVpv90RztRqQ2IUYVAVSHZHPOtV+VN3J3XICHk0p8SbG4uWLk2OrbQYme9MwAL6qW?= =?utf-8?q?nTX1w7Xxlc8Ml1/xAchJn5AaFxd9Y3fLpv+FCN0n2MmWVp2SqTa3HftIbfCLkytzL?= =?utf-8?q?9Z0af1P/Aad/o8ZcdXHKMw0AO3y0uhjWtOmZLnvxHoCtyXbUoHGVXSr6Gz6zwiyko?= =?utf-8?q?l3wGmrrV7RexfnAVgtppeiyMYJnuQUI0wT3FVTz61wFcxC6d3ELHTUfbc8SF5xcWV?= =?utf-8?q?0XthPMXAX7BZVywH4TjGhCYV5UHJ6D2dRKino6AjjS8+dxUhQNTUvYOblXLBgXEJJ?= =?utf-8?q?qT7sFG7z46E5XR6Nfy0LhltCB9BxGBDUL2FVAQj6xICSxleyQO/Lq0Q9ZjDjcPXLi?= =?utf-8?q?3ZJoPdLirdA2dcuK0knFTVkUu8jFJFBIUH46x5wKOlIgR5BDhRKBWt49y1gPnT4E4?= =?utf-8?q?94yAjcsT4RcUATc5ry5duiBIgu2LtlmoFNyD9/YpFXWQZ09JmMQFIxhJurv94Y19a?= =?utf-8?q?xRmEkaSuEj3wi8wymPmRRLjNIjS29dEaYgpMtpJc3Jg8eMQ1jcfE59wX3juwKwLC8?= =?utf-8?q?M1swkDTnc8ksN8G6CMkKdLjhwZYhhkK9o/KL4sksqsqtnURIQwW66AJP/o24C0hU/?= =?utf-8?q?XfP72LYOLd2B3z4drc95tSXlUb4DGuS/mBR9PhqtK77dkvxKYhAJYgOiNh4KEUOsY?= =?utf-8?q?Gxd43X6tWnwdb1/3RcLPgW1Oi8JVCgIa/dZPfxmzGyZGDLmomI7FIklnSNvBR/TfR?= =?utf-8?q?K5iz/3zGIgGluc9pL4jhLClBmdHLWsxjQjKF06fRTeAhd8rqXvxpZeIU8PPq93j9N?= =?utf-8?q?OzwOZL3+dcuF0DjdkC0glVZqljx5EWWk+TxNknG7tka4+SM5O4mKoD4d/OU9CSELa?= =?utf-8?q?sQ2lD0rbVDL0/+UsSQgCajKGU6rXYHDJNKs5YiwWMmX573UXFdf1xAKQ8ve0aiP7+?= =?utf-8?q?TiHK3EV82NhhzGtWv3tRSsChYiiP4tQ4c0GA4kuFGTaAK4pCq77iXazs=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?HX+iwCWM1i82tQ4cajtrqdLK22ko?= =?utf-8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ue33hmuFArf7IkwMFhfDa7fBitFFTN6faWwDAF5ko/tzPFOmhnH4Rftq?= =?utf-8?q?HzCr9PzeB8DwAJWS8XKYS8kQWvpFIokBOqjve4HB8bIT5I0fd/GUuSg3+GAoT5Bfj?= =?utf-8?q?SZ2qlSGAaooMPtaoaMCYdIxYNzLEorH2pj3l8pcI5BcTLCDuiDcYC6pFJDjR571Sf?= =?utf-8?q?GHhA7dWDkCsDRETqS2Bs/5lcoVmZ+D3zcBB3EsXYDc2/UmtfmPWLHPFN7sJTjNA6D?= =?utf-8?q?Q6MV15kbM+1XLucqLGVK3lEzodrBtCYZLDCwwIz8U8B4rHsCq+VYmeQAfLUixU7FX?= =?utf-8?q?xsdH9RC6L0JoRBQvTGHwp8YVC0RgsuUQczsBS/mTEVukP16r2FtHfr7A3vVTfYjQl?= =?utf-8?q?Pi1F9Kf+yJIpQXrvtmBgYsAFE+lhDfDy7UhlmacyIl+N/yKIYQPjg56Gwfdh+hcBV?= =?utf-8?q?Np27DfL8hJXB+y+zktfxyUCrEs1mLzmIhbJs0bAnVNUTG4iUQaTp2tapmLLINnEij?= =?utf-8?q?axgG2RaqK7X2KcIaAV/GVn0CGYCXK3EBaOYfnF8C1XPqr+mQ9QCdNDLQt8yqi58or?= =?utf-8?q?Yx/yw0Ia6IEpAcUMc/tP3Gz4C1M1nuMRrPA6jo7vNaMhzuZCQHzRj7mJrs6vxwrXP?= =?utf-8?q?aA9fau1ED4Xn?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f321deef-96f6-48ee-0b73-08dc6c3c5f9b 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:16:13.8452 (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: lasWAHSEU3CxIZoEiNBOjXZT/zjQItAD5txUd1NRZGwJarmvJdg3IsFiwxyqubcEn/E1ytvCZx3FX7rxsZyRBQ== 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/mediatek/pinctrl-mtk-common.c | 4 +--- drivers/pinctrl/mediatek/pinctrl-paris.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index d39afc122516..91edb539925a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -621,7 +621,6 @@ static int mtk_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; @@ -629,12 +628,11 @@ static int mtk_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 = mtk_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; } } diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index b19bc391705e..e12316c42698 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -536,7 +536,6 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -544,13 +543,12 @@ static int mtk_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 = mtk_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; } } From patchwork Sat May 4 13:20: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: 13653974 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 89FD2C4345F for ; Sat, 4 May 2024 13:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 6FC9AC32789; Sat, 4 May 2024 13:16:35 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2059.outbound.protection.outlook.com [40.107.22.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id BD3D7C072AA; Sat, 4 May 2024 13:16:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org BD3D7C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIMM1EBcMpsAfoIajRF8lWxzqD5W5hV8CGR9eAQIs2T1oAhTOaKF0HCpJcnlc8sroJw018a5EyhoY5IExC3qqM/iF61FMdZnyHLMLCHhq+o3yrexo0iu9Xr6TXSyls9xJcIV9CfYgZ+X/aCnw1tL8enOeJjt4t93iHXGazwvHkTRL9iCy39v8F84rGNy+ty1x9SjkVGouTe9sqS0rH8auDRgN7zXZLuVBTATTG/Q+EUh8bsjNjHp+HpDHsA7LAmZVOH2dIy2QjpI/oaqPgOrLmimERTvp+7q6Ez3IYJqHLdlc4/GhQ5pFdeXTBNPcjCVidkv+cXMKY7URRnZ/9XmTA== 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=G6JJzIlsATPz+eeVRC+tmQRXVLBCszxKxTWLO7z/7Rw=; b=iIBs6qs50gXDdVnot+R0Tt18PMfLYan0y5eX4WWZBZ6Rmn1OplAcASf2Ui7+GWnY0XYgH1qEIPRphOElHqDmFQ0Zwp6kIoZEpOkkA+jGHrU5kIwPxWj4a7Qfp9QyPyfzFcR/YpluMQWUoDneKgvXgDhQd5yzbpvUzSm9pGJU/ZhPNAtVfq9FVVodtKKzBKFkmrN+CHcjg6/6ldPW3ecglLQ6llosWZ/4FQCY0rikWyE9gVaYAfal2h9nPcS6PsLMFvNrT7JYHLWHqWyNYPCV/oFruvx2k2GN5W83t6C/Kc8qRswy4wIevZm6SgryLF3MhM/fbgDlE6Q6nM9FCbfr1g== 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=G6JJzIlsATPz+eeVRC+tmQRXVLBCszxKxTWLO7z/7Rw=; b=JwGL8Zs6PoyHk+U+trsx6DmiL7Uh7CdB7QXcgZ7fwYsKtjlQTGUndTL/ynWE1SI9AmOVt8aHUAITzcJGJjBmYWjzAdmi/zHzu3mXgciACNlrVtknBQWSZS3t4z9FZHrkV8M2dvU6mytpNprf/CaijdDfxEEPyGCXAiuTQK0BNhs= 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:16:30 +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:16:30 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:13 +0800 Subject: [PATCH v2 15/20] pinctrl: freescale: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-15-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=5535; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=CgYPpbd8zRZLHMaSBUod3MJSkUGYYuTkn7XHxXWmDfQ=; b=QThPNXw7bxO4a7RWVR+x8/it3yFCdDCIJhct6pJk1X4WfCzb33CCZ6xXajsk5epDPQ/hH1F0c spUFq/qYsKOCFwSsFFp6AnQ0TVEi4pJVnIpdLi/K9c5op0pxw0uris8 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: 826172fc-8f7a-47ae-4b44-08dc6c3c6988 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?oCEM8k9tR7q0B0/fG7ExEQCQQ5l1HFC?= =?utf-8?q?skLK3qMFv982FR04Lgr+kfktjdk7BLNGwUlkXfo1RbEXnXVNjtCH/YiZsjHOgnoAp?= =?utf-8?q?UBxu0UchRUjodbcO1kl9KTxjhWmi61vOTdIXdO5rDsgYhA18hknroBsO3+obYeTR8?= =?utf-8?q?Hfdw0Ue0issfoWWl6ZZP6P7Eq8ILFFrte9fCCDQdsyI5PhJ8cvWTMJ+8ZJ77p74Hh?= =?utf-8?q?/X3JaZSpVeDfG5PIk3ky/nHgr4xNXslwfzD5/JaPZBzheu/52+Je/4huA6AmcyvHY?= =?utf-8?q?KAoAQDwm27ufBghw0+yd/f7rNQOkIPoCqKimgbb9Yadw3lBK/cVm0c1fuRUpUW1pi?= =?utf-8?q?558W3EUsN7FvW28u69BITFwPLU6AzB0pI3nDVhOAeJqdr5438t4MEF6vJTIvSFrpD?= =?utf-8?q?6KWSWYVVxAgH0jJyWRyYBlgdGwU/fByw6HNlFpygvxC4L8B33WTOWeBUGwnaY+jzP?= =?utf-8?q?X1LI5DDhHNUQZ9wX0+6HIs9FgLRyvhB7BaPDxnOyB8Ox0LlHu5jl7SqCJ7jSG13+H?= =?utf-8?q?KqQkVE82MagVq73J7gA9f+XRMFVAO2KY2M/+Mm6XjGEzlnrNCgjPkjPFOyh3BTKyg?= =?utf-8?q?hV+SBXg+kUCeOdnEtd/3dwr0YGTV87DphYkw5bHFEgppLljD7SpORbQhyNK/PCoLy?= =?utf-8?q?e4MAi3fQj+ToFYWGonVI8xozH4iXaKnu2sawW7dfH3VDHp4of8WmV/HNlWryELkZV?= =?utf-8?q?IbSKK7U1h8qGkbiqmTDcczN6WM3DJ3R7k6PQ5xkfI3uq+Wqh/6ZCml/fBxkt1Qi1X?= =?utf-8?q?vEjg2oBK0Ol7DTPNoXZN2z9dLv3KWc76/qnDpMmKiACqHkebuRwCCYTD4iZUxyyX/?= =?utf-8?q?+feKnBSOONdCg64MexoaqxKpABim0oUDbS7nF9N9cidI9Tmvrehcu9LqaaJ/0ftPv?= =?utf-8?q?KK/S3VOnWBSIB/YttkI5XZr83whQiopfum+L16hr6rYcPIKensL1KhqWsCgDyhBC5?= =?utf-8?q?cj1PBCXg787UHUP5BkkKYXs2cTa2AXuGkI/XqaLB7YWH5Klnv7JBRaoWjXZ9QKvEq?= =?utf-8?q?sqQ7YCILsVqTRTSAhCmsGEpx2TWJ8AsumBJjZ9JDtSgH1S0nA3kPBbLtg4A8UVMgv?= =?utf-8?q?PKql5u0s+FEq6l5rbPikoS+2pJuh6QLqIpvwWMYwVB749fIlTV9g3qlCQZcwgTf6W?= =?utf-8?q?gNS8hgthapajQkYRuP3ISvsvmFItzMZiDcmeYGQhsalV10tW6XhhS/ruLf3e3MC/W?= =?utf-8?q?bb0Bvz6f5COv1FDG8ZwhY+T6AwDDQQBSWYsJQiFbnTTEHPBQOqWzjuQZ0jXs7vCJq?= =?utf-8?q?NtaoSDaV89UDScBjoYf3upchkBAb8opSVOQ=3D=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?8RWWc/KtplBS2UCsXZvMfaFIRod2?= =?utf-8?q?Sz1limKFzSySJVbhImZIo14HcAZt8VF4o0HdKWB7vOz61AuvI/3nIvyaZ1xqsTzAn?= =?utf-8?q?r9psfqaTFibuMQXGAlJty/X+N4XK/bx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nwu?= =?utf-8?q?poDy3ebZ1nezX4G02FxUt++yqnsxziE/eP/Agt5hCob6KXwAj1kt5brZc3mqqNL8q?= =?utf-8?q?p636F09TjdM/lsmCzSt7avWm4S9wPPLmshc6AM5/Jind2weY33Tbuy9sp/4AAQwXU?= =?utf-8?q?ggTOLwO0MfHkW1qrwCzhpqX9L+On014pAQFzh1hcw1qCOgckzUSbN9gDsGDEsIe2e?= =?utf-8?q?oRWGuG4pdqcAYM+Jayb//t8UnjuZp4Qyjkow1pCrKv2L93XxFwl3pSlL2YW6G0Fna?= =?utf-8?q?lIBrku+FU7dLvegO3c+1vPpakB9a1bsP8BzszBxsXewpcYuYhNd296no7yea+2Gyt?= =?utf-8?q?aVFyFpwdGJO7htRSRCulvk8AhjDOAP+5q8SXhQ4wiWJx2QoIso1NJvk42Fb/lDGQ9?= =?utf-8?q?NDJhEfX8D5cToM90V1t1GEMoBFOdBb80tdm3mmEYX1slQhY+KNOiLBseBYnG4BOnE?= =?utf-8?q?iPN/yIe80TMFbqo3JlMqXpgmtHKJvqTRmCr13nsOdG37bGATPPBfflGCiE1iMzSEk?= =?utf-8?q?tcOEaBrvJCgZ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 826172fc-8f7a-47ae-4b44-08dc6c3c6988 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:16:30.5045 (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: vZZ7kr3dkSjhuW6rezuQjtYbweUoIm8juzVfBE1tlEK9WX76tRZQ7SkDKVhXwIHJQ/qGFmQ99JQhT5X1sU2CgA== 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/freescale/pinctrl-imx.c | 25 +++++++------------------ drivers/pinctrl/freescale/pinctrl-imx1-core.c | 16 +++++----------- drivers/pinctrl/freescale/pinctrl-mxs.c | 14 ++++---------- 3 files changed, 16 insertions(+), 39 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 2d3d80921c0d..2b7448e3cd65 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -580,7 +580,6 @@ static int imx_pinctrl_parse_functions(struct device_node *np, u32 index) { struct pinctrl_dev *pctl = ipctl->pctl; - struct device_node *child; struct function_desc *func; struct group_desc *grp; const char **group_names; @@ -605,17 +604,15 @@ static int imx_pinctrl_parse_functions(struct device_node *np, if (!group_names) return -ENOMEM; i = 0; - for_each_child_of_node(np, child) + for_each_child_of_node_scoped(np, child) group_names[i++] = child->name; func->group_names = group_names; i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { grp = devm_kzalloc(ipctl->dev, sizeof(*grp), GFP_KERNEL); - if (!grp) { - of_node_put(child); + if (!grp) return -ENOMEM; - } mutex_lock(&ipctl->mutex); radix_tree_insert(&pctl->pin_group_tree, @@ -635,21 +632,13 @@ static int imx_pinctrl_parse_functions(struct device_node *np, */ static bool imx_pinctrl_dt_is_flat_functions(struct device_node *np) { - struct device_node *function_np; - struct device_node *pinctrl_np; - - for_each_child_of_node(np, function_np) { - if (of_property_read_bool(function_np, "fsl,pins")) { - of_node_put(function_np); + for_each_child_of_node_scoped(np, function_np) { + if (of_property_read_bool(function_np, "fsl,pins")) return true; - } - for_each_child_of_node(function_np, pinctrl_np) { - if (of_property_read_bool(pinctrl_np, "fsl,pins")) { - of_node_put(pinctrl_np); - of_node_put(function_np); + for_each_child_of_node_scoped(function_np, pinctrl_np) { + if (of_property_read_bool(pinctrl_np, "fsl,pins")) return false; - } } } diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c index 90c696046b38..af1ccfc90bff 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c @@ -508,7 +508,6 @@ static int imx1_pinctrl_parse_functions(struct device_node *np, struct imx1_pinctrl_soc_info *info, u32 index) { - struct device_node *child; struct imx1_pmx_func *func; struct imx1_pin_group *grp; int ret; @@ -531,14 +530,12 @@ static int imx1_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 = imx1_pinctrl_parse_groups(child, grp, info, i++); - if (ret == -ENOMEM) { - of_node_put(child); + if (ret == -ENOMEM) return ret; - } } return 0; @@ -548,7 +545,6 @@ static int imx1_pinctrl_parse_dt(struct platform_device *pdev, struct imx1_pinctrl *pctl, struct imx1_pinctrl_soc_info *info) { struct device_node *np = pdev->dev.of_node; - struct device_node *child; int ret; u32 nfuncs = 0; u32 ngroups = 0; @@ -557,7 +553,7 @@ static int imx1_pinctrl_parse_dt(struct platform_device *pdev, if (!np) return -ENODEV; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ++nfuncs; ngroups += of_get_child_count(child); } @@ -579,12 +575,10 @@ static int imx1_pinctrl_parse_dt(struct platform_device *pdev, if (!info->functions || !info->groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = imx1_pinctrl_parse_functions(child, info, ifunc++); - if (ret == -ENOMEM) { - of_node_put(child); + if (ret == -ENOMEM) return -ENOMEM; - } } return 0; diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index e77311f26262..aee70fa55bec 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -490,16 +490,14 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, /* Get groups for each function */ idxf = 0; fn = fnull; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (is_mxs_gpio(child)) continue; if (of_property_read_u32(child, "reg", &val)) { ret = mxs_pinctrl_parse_group(pdev, child, idxg++, NULL); - if (ret) { - of_node_put(child); + if (ret) return ret; - } continue; } @@ -509,19 +507,15 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, f->ngroups, sizeof(*f->groups), GFP_KERNEL); - if (!f->groups) { - of_node_put(child); + if (!f->groups) return -ENOMEM; - } fn = child->name; i = 0; } ret = mxs_pinctrl_parse_group(pdev, child, idxg++, &f->groups[i++]); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; From patchwork Sat May 4 13:20:14 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: 13653975 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A33E6C4345F for ; Sat, 4 May 2024 13:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 890BCC072AA; Sat, 4 May 2024 13:16:51 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2085.outbound.protection.outlook.com [40.107.22.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 4D225C4AF14; Sat, 4 May 2024 13:16:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 4D225C4AF14 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iq0+wWzoQ8QOjJwjhT3U65H2p8s/t/dew5fgj3ZBpZzUk94yZ5xiSQTXDrbvtCsvKitephcf/XzfQs2ZViYgQN5gfd6ViC1nVLrEVKjEmQtDI4l/MsJXIB9Nbl11lNRyFIUpXHNqe9487vJW2J0u2NthW+NgwEvEoDOzbc1p/zC/rNwQTER8ZCEnPsOhweUwo1Z3BsPvJYle71vu8RTC4FvzBKeeKBmkimz6ADvmiRhfBlwz6HKqi5qgB6kSQ00sLNpMBiuILfp4na8qWwd8okkSij5ege9oLWCgBwWWZ/mME405ItQu9locoPpASh1+tFLf8mTXySgGLz31lgnu0g== 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=b8YW68N9lyxeJ9/mVk16q9wzxsh3g7k9BYoR+TfhQy0=; b=UE4qcH8Qe+cAnvJzlJYA4nduogUPkrcB6BJOqMOhNnPn8IiDdbCGoFpdL4StqFnNlceH/+46kN2heoV8Vq8jSzfqVwyLVn8w8uLkokRQbDw5ny+DnsqRNsXWE/5oG93KFp0cxGHLmXyTz7jQsI39SL1i21jFaSrstmClmLbCn1LOH17wXCa18NxKP5h8/5EQNSax2tXAEda3a5T/G/Kh6h0hC6qMrJ8I6Va0KrnV6MdQLiIl+CqLLuJf8YGyrg1b1QKAcDuVcD0m13hywuqt9PIJ141rjv2TbAl4BdEMo/W9C1KzPRsnlAwdGNZLXQkgsy5U9DBnPZpzPCakUyiaIA== 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=b8YW68N9lyxeJ9/mVk16q9wzxsh3g7k9BYoR+TfhQy0=; b=hkF9lq/jMcSmd1vDCP4Xw1FUFal2vtMiBcdMIM9IGtY/RbMqABtrwAJ/XD3hbLK8tTye+IspbuC5y1BpSRyaRYHzAlK6rsUAqHloELbRn+VX1eNkANyQqyLBPRR0toDsqQl3oXPWoUwPEZdh+ye/fqC2fSv8iNNIsw0PwMz2xQU= 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:16:47 +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:16:47 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:14 +0800 Subject: [PATCH v2 16/20] pinctrl: bcm: bcm63xx: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-16-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1176; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ngb8bjYWoY2vP8GroJ6WPcYXu1rPDt13jwjXmDP0P84=; b=DCvLS+tJSjIJOYzv5GBcRPWdyszwIStRArI44CNxG71LlT4DW0wLaiJVWa3krSYbnAQteIYKQ axMlCLkIflgBmSjBIiiZAA++axwuvzMqZXOU/It10tJ/dOb4zf/rLxO 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: 039ec075-bd8d-4c85-d9a6-08dc6c3c7377 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?/7nQeMJU5DmcMfHEXPODtBRXmEHbvVq?= =?utf-8?q?Py3cUP3+44Y84/4nQL5tdI2ZUgK7bGjIk0MiRheNznJrRDEjITgF/Lmn4wbFMdWBR?= =?utf-8?q?QhA22ez4SH4hu0am/8TEUlwMjc07vWUAOrqbG7LqKt8kda4aGupmBMv1ZOr3MvjfH?= =?utf-8?q?ptAKRD1DHsVcpPw8FKUmfQjp3O5P1MSyiLfupJMEbxcSeX7R5dz1w5y8OoxM0r1Zp?= =?utf-8?q?Bq59dhzwKL94jB88jY/DIWRaho39gWBwsuS4xdRvP/b1Or3RDRiZ6QCzlSa5rjkfn?= =?utf-8?q?t4BjjIZ1QSBSYZuvkca18PO1La20nXBkw4I7i3i+4yM3xndClcCoRzmEShr5tuCE+?= =?utf-8?q?HP5tDNExXbJEEaa/Al6Fx66nTGVriSkwuzL8VoLyDZoVG1CltZidFFg9SUgcAYlqk?= =?utf-8?q?miFum4jkNqndqyv93KatUvkIeTLSB5iE8aNl6H0tH5udDzPbz6Od8aOrgDqoYm3I1?= =?utf-8?q?uarsjlufPxe3agGWc2ZVilLbdNjxQHFBR3y5+7ciVd9QSvrSt7h3ir41LNxQ95ubx?= =?utf-8?q?qQrDQN2Z35LFwPOmTSJur0SSRLcQwVl6ROHqVWjU4io4d2HkuYcLEOsuSuI90Ufpp?= =?utf-8?q?xe25caVkC5FV7KVufuln7prQngKYr+grZoKiyQ51CH4gH94vifvFS7+67wqaeYCBa?= =?utf-8?q?aWKbmvJySvXc6cQpY53Tdf+OQMMUfcWP4lFpY6PDPGlqBFvLdabxiOwQ1y4h+BV6W?= =?utf-8?q?wD2wsLT0fWV+U1mn9876xTBvVxx5M2bo1Up17hThSCDswuzrb3fxXVLSYlFEG3CGE?= =?utf-8?q?Qll+K6aMOrjr9YPaNKJnjWDcwv7pkTkZLDQcZLFUVzoYR5YzyLnDJ7QyFnoWAZHsZ?= =?utf-8?q?lbgD508fJXeiSSk31+oejzSuEARae9rs54oDSxUv0baS+zS25G5S20QNB7BOLHnsZ?= =?utf-8?q?yCB54QZNvph3lFE+EUFpy0BNj5/RBhxfgUUc8rlFf+4uZAzk4O7lR4wcIUV6XB5OU?= =?utf-8?q?Fz/OOPzuaiIeSlT0nxNM/a4Q+yabKC7S/6PXTYEVriwzHst6Yn5wnWDO6VjrkGSz7?= =?utf-8?q?tQNShBp6UlvC6mosOMbeR0pz+THLevcut9DRuGIhzJdBofM/ltO4eoTr4tHMj+0eC?= =?utf-8?q?hCvJrJA417rf8JkkkG1t7dr25o+G/ZIQaGZvDc7smCWVq/K9haCF43nuNzA15PB40?= =?utf-8?q?7PKFFRRkDOLnXCMRgDz/HSGftI+wcu585dD34ZMiRp7AtZMC+mDZlPdSColcJ/4sG?= =?utf-8?q?9BXLPcvUXzQsKwUJCwkO08YaTgfI5O68z8KjpoEGi1UtIi+OXjPCzgqXJhk6RsSMp?= =?utf-8?q?vuQCowYUnktsfGC6paVwwYhmH4hS17ihsyg=3D=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?pGqNSNdOHCOW44dy4E/8KywqNsmV?= =?utf-8?q?eRvA3TcYNxK3TYMlKe6Zt/HRkKvwmGAjhoeCJrl1yX9ccLgS1x0EoTR+D7uLkK8SN?= =?utf-8?q?tBgfYMTaV5IAE5CmkLRXbc0tXqJgMKspw6OUE+MZDEx6HnZaIt2h8q7z4SDfg5g7N?= =?utf-8?q?8Pr1XLEI1ONubmZje/jyHYqDNNge5ykZmzo8NZntKdG8oQWtUDUhHxz5LVR/XI7Nx?= =?utf-8?q?0vMtMCZklJGdvf1zGLvywdPq307Y2yTBGyVVagF0K/EBUfFZmkhgWWwdiS5Z7RXu1?= =?utf-8?q?OSd+jx+9RP5s+hObmdbOXoLLKeqvlHbirRE9IYLXMYqHO/b3LvbdQQjEm8a2vETG3?= =?utf-8?q?L1ELMOu94B66VkJrGFAQ6EltfGm0ieP2K2BKU2Ml8UZPYTJzHhYFpAkp7ZVk0Oa46?= =?utf-8?q?6wt+ZBm17+BlYxIuKBkHFo750frYtqyn/yU/je8c/MU69QC5H3hfFLAX4bdpLcpFn?= =?utf-8?q?xNtC6b1XG4nA4iJYvFeWIqFo/gE+vhEIrefuN15VUcvGeprC1j9BrCaD19A94V2+e?= =?utf-8?q?5s5seg+k3N4zIneXXHBbs+eW50idFNxWM96ZPNE+woArII3j2MId9+Fy162xnYoVz?= =?utf-8?q?oxXCXcGkKAItURE1jVZ7w3MQPNzOMY6Lqi8f74QHxUtPt7b7FTb4UHZbujBn0yB67?= =?utf-8?q?2dtRCHQ9BeZSF67b+HQOi3j7HQdXqk6VoEgYH3Gd78KSK8Clx709i+PRGv91c4iIu?= =?utf-8?q?75HBRNjhkVOtdI7UlcIfkoTdfqaO1rbOSjQ8rO+VG6pKFdqkQr389U9/+nP+FPcWg?= =?utf-8?q?c/wxV+9l0FJFFath20CRj2D1bCXA7fCdbYeRhOikC0TXGnzai1oHrmrLb+miV994S?= =?utf-8?q?eTxA25w/KV0Tnbt5bygrYAWZuWM92Vobq4OxotL6DZk5vWCojPnH6FRVIdbsAvj3W?= =?utf-8?q?vTG14PdNTf5IkjYnq7FdJOMrrVBMM+ScxiEKZWtdWrUJDu+AzM1qalqnO3kthj2w6?= =?utf-8?q?ytWu+8yTyhe/n3qClO51blW/+4MoicEFMFAqRmNFxGfDOT8eNkT4gO7ldEkt9nL9z?= =?utf-8?q?Y4rGHUcV4lfZZug32M+u/LWtBbGVsTcxoh5vuHAj6/ZgvI53LwS1EHOyl/uWXE4nU?= =?utf-8?q?hUF+s5CN28t6PmuDoZTJTpswoeUxLiMJYPeyYue0ZPCkcalEgnkmwUJMnMYomNv5b?= =?utf-8?q?o4ovKIw9GaoeI/64NrCbMO5YBDJJYRsF31lMYEfSljNcxuRAUjLsf3K+499NVesNU?= =?utf-8?q?QWRfnibHFGDRLDhbmGZfDM0cJPufIXwzDSxjimTkOWcmuJEhIoCFiwOkGgfvI0Jwe?= =?utf-8?q?AYDn8pjQ2xIESH/2TD2F5IY30AGkZidjiWuYgi1z9KGg3Oa5S00amnBXFNSZM9gD2?= =?utf-8?q?YNT4ssxs+PYsTHMIQu8t1xA5dFMnuKkauWO/xuemjAKOsbeNuchE4bpbOLnsR2RSv?= =?utf-8?q?g6WDWVW3CFv9jH5ds/MVjeXERpODpXqL6ufIcNCd3mxLu559wz8+NxcdFtiB43bIZ?= =?utf-8?q?MOeZmOfKklXxniTVR2AGCXU+1uqepKaX+AcGr+fLmG21jzRcuq60l3l98y3cuPmFh?= =?utf-8?q?HCzZOaoEXeOt?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 039ec075-bd8d-4c85-d9a6-08dc6c3c7377 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:16:47.1839 (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: shY0dafUZUsi2/PfSPmiPNkIGEOpXTthpisY1rGu+XtACuv/H167vsA0VUdr90Fmv7gkwOa2dZP59lS30mxyRQ== 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/bcm/pinctrl-bcm63xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c index e1285fe2fbc0..59d2ce8462d8 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c @@ -67,7 +67,6 @@ int bcm63xx_pinctrl_probe(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct bcm63xx_pinctrl *pc; - struct device_node *node; int err; pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); @@ -94,12 +93,11 @@ int bcm63xx_pinctrl_probe(struct platform_device *pdev, if (IS_ERR(pc->pctl_dev)) return PTR_ERR(pc->pctl_dev); - for_each_child_of_node(dev->parent->of_node, node) { + for_each_child_of_node_scoped(dev->parent->of_node, node) { if (of_match_node(bcm63xx_gpio_of_match, node)) { err = bcm63xx_gpio_probe(dev, node, soc, pc); if (err) { dev_err(dev, "could not add GPIO chip\n"); - of_node_put(node); return err; } } From patchwork Sat May 4 13:20:15 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: 13653976 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E1C73C4345F for ; Sat, 4 May 2024 13:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id D4434C4AF18; Sat, 4 May 2024 13:17:07 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 996EAC072AA; Sat, 4 May 2024 13:17:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 996EAC072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlggmPZvqE79ZaeW1gTAbA+cs1kIqi2SIyvOM1HB4159JF/+JtCxmfQiW0ivqdXP5CXkKje/nyrmWH/Yrn/GJo/ayUbcZ+X7nWP9o82PvscO9WYRE33rPFwr6REMQXZZgRmeuzGld47CW5hNOyINSpkGwwt41YY4W+dJkF2OBzO9Jru7wS7dw8RyU47sOrtdJeQefKEOH5Rf01ZmrXjRMuEfr+0BICN4NYt1LACPnQEuj41Jh4qqSfByzmuZ1dMuc1l7qwVm73K3m2oHRU+DAEs8Gi2JKGyam4WkrpLUqSqCD0bxtus6agOBE0cWUaxvdjW+UkG+HtJXUKZx3q8OyA== 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=OzFmWqqgAaHNbNJ4y5r21eHdO5OywXD/utfmPqrXP8Q=; b=TgVpot3hegYYv3qbkWnLZxHoF9Lz7u+bMV5C77TdeGnx3Ry6fBW9wp98fjl8BNVSkpfnxfSzk3ETv8W9t2zD/MuPKI01Ilsgqe23L7MPimZ4SNdsBCI/2UAeCuxN6ej1okwS8bXnqP1nsWbmIvxD1AAwBe9FFp/+vFE1GVbmZ7o0jAf+PHqp2by/jQp92NhEoS4xiFsH3W3i6UgEzOCXNB7Bx+Ti9HYrCmDvb++GAKFHiKLqPkGZY6rNJHrWf3p2+OGupUqsfQOQjc1jZs8Th7uhdyRGqBvFpKqcjOU4ReHTJRv2IQUjfDIG5+xEw4EY3//hA5atG4ZS1cixltpUMg== 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=OzFmWqqgAaHNbNJ4y5r21eHdO5OywXD/utfmPqrXP8Q=; b=Hujfgk6pBbJGD9Gn7U6zkbL3oeUYDzP9UMdHGvZL/K+xEh+dg1xpaQYo1lBHM8dRZTsMDLDcMg7aDlpeBuyBnsTkrCN9AI7lSKXvaG3RIin2lRLyV/vsqE6L59CW7E1hXxjdoMrKgn3ksp4JBgAQIzBAi4SZ3isnWO3ZQqIciJU= 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:17:04 +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:17:03 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:15 +0800 Subject: [PATCH v2 17/20] pinctrl: pinconf-generic: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-17-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1107; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=2wM6S75hkeICu8KMVBGWw7nINzfNCEUbOtGveeJZglQ=; b=W5Ezlhd9RfExH8zWzuKwrmVUyRSF1AbQsCIMFKOLEKa6ZeJmr07/EaJgdP6wSTycJk1QVaR5H zbLbDF4FDjFBbtd58shfrCerWTDLaxNYTJIpazadXEO2mmS4+ShJxp+ 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: 0c1176af-102a-4e3f-0f53-08dc6c3c7d6a 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?DdikzDKEmMOr8kCCk+DIhoh4V3Om6JX?= =?utf-8?q?8zvr293WBwCkO5zN3r1R1nguEHpcU2FgRZ69PDpIGhXBU2oQptG+/4fe0P2QEoz25?= =?utf-8?q?JdUjAge0UwjtY776v6TVQJjgPtNspY9TCg5hoGCtPG2EBnVrrUNJk/F2tJaJ5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?= =?utf-8?q?KuQ6wDzmLjLfPnWdZd7zOf9+DAfW+9ZRw+1LkVeNrP4mbui1Wn+Hz42H+q5Y56Yjn?= =?utf-8?q?X7B6TPiIPq9a3VaC2YOH5QBMcIVNk7xUR/Sqw0ifvrO8J8XlItceggWlTUohLvfdz?= =?utf-8?q?QV6Zjm4qASebgb/mNJ48bbLBBkReFK17V8DDM3Zhu7jh84eDnzLU+08N3PpA923pP?= =?utf-8?q?Ayg7X6PtgHUx2odrszIrFXPMaUMOx0cYxRS8jUhSa9HFh7TFxS+vBCJCwQaTLM0d/?= =?utf-8?q?Q9tUXfPADwY+gfIxAskUGekrTbvrNDIe8lMFMn0euljNvOtJCVLh9uYQ=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?ol09Toww7IhsQ8TQz7xB63ohG6rx?= =?utf-8?q?t/0BWWJF6gVo+v/WvXZoYDEnZajxSKG35Ej/HKzZM5pCnpcwxC8o94GB5/0nbIwUN?= =?utf-8?q?NAtzc9w/Qa4ltRoXEN4igcZZnAa5Fk2z7ukveTb6TfGsbx87rT3F1iMcNihfbADdp?= =?utf-8?q?XBBgm+RXdflxczUNhiILg0KOSpeFpnQ11bvKMrq+LnBFjXE+ocO0bRMs2ZJvt+51O?= =?utf-8?q?RwFlhKgCHeHYvj33jIRnDUCQ12GZNP3aZth2QNVSb6GQjDf0ibrhoXHH5w11yi0GM?= =?utf-8?q?xAp6f6DO6rwoePs5Sc8w7BqwoRRGs3OQ3rpTIm2jlJPmOZPBxw+xFgXt3tFohcZWH?= =?utf-8?q?fn4B7W6LUXBLx3ISzMHymP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HhKxgciO6fCVRLpHoOArt0Li1IyKcvVQTn7j+DZ?= =?utf-8?q?eUw77uthUF4j4y/Kb8KnfzTQFe4aPEjf/R2Q9jz5UCv+y+ZjTkJ3ItZi83alCNHgW?= =?utf-8?q?L1yuzDadDyjzZFHR+kKEDG/iolcxJwzI2VHgbNGQcBDRkRFYj/9DYJNuM8nkHApT0?= =?utf-8?q?qlR5a0TYGfJBJkrSGbBLhWfZuGPrpEDrhDjfohonie2GYzdKja/v28sEYLDvSR6rV?= =?utf-8?q?PEGypaurmP5dBNDuyz0e6ICJf8dDnmuRe/ClF0ndV96DbbGSSoRRkpc0BrcBPbGpY?= =?utf-8?q?rGqyMcFmCYKd?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c1176af-102a-4e3f-0f53-08dc6c3c7d6a 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:17:03.8642 (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: QEgJUaP4zRnl3xuiECIIdwnDgtv8meyTZQoA+0gbgaDOSP2A4ZANHr3rQdpLv48ANaBT0NARX4dl/yrvw7Rd4g== 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/pinconf-generic.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index 80de389199bd..a499b8af5c1f 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c @@ -382,7 +382,6 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps, enum pinctrl_map_type type) { unsigned int reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; @@ -394,13 +393,11 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret < 0) goto exit; - for_each_available_child_of_node(np_config, np) { + for_each_available_child_of_node_scoped(np_config, np) { ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps, type); - if (ret < 0) { - of_node_put(np); + if (ret < 0) goto exit; - } } return 0; From patchwork Sat May 4 13:20:16 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: 13653977 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BB755C4345F for ; Sat, 4 May 2024 13:17:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id A5826C4AF18; Sat, 4 May 2024 13:17:24 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2042.outbound.protection.outlook.com [40.107.22.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 70108C32789; Sat, 4 May 2024 13:17:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 70108C32789 Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uit+z74daa9mOsT6ePUJ2VMAVskH21u3nzQSgbWmY66uHTJ/hJPh1jE2HKUZb6uVYEyh9QWswo0MpHO5IRoT3gaPUQ8ozqL+Zol0j8WJTB/1Bg9/eMtv3pEgYzA6jo96MlfZ6HRJ87eGzlxhc2oetuS3TMwOhqbF/52fIV9eHEewG4Rz/IO5TFnv8WDYQma1FaukRc7KZGSJD8jiuIt/olxWiHkrxwJidc6F6x/q7x+uqxpYfLP9BVTIK7jNmlsbWAdJ98bwwxslgbyXMhrZhGwr+AfrVapxsgbV3SzIiguWOuoxbpsm03n1hioZxn1LE/JYKOI8rYqMJ0PxPefLBw== 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=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=OSk6CPQoV8WoO69chXXc/btdybtOIRVLJPiTTfEB5l1MdnqEtN958wiXrp9lYGxp9hIJpgEIkQqLpT0OmxHgBKme/YUWV7INO6IHFnNXbjPyMae0RDCRa/oTYCmWuj4Zf8oTzVeEPND8FPz7b0fUw+KzjMhbgES8lmowZv5ACW/WQuxDyS+LRkDiqyhLFbZZY7e45IvTmYRjZy6Qmxb8K2F1f3Ycapp56u4pSIujKebpsUkM9I5lNGnXlfQ96BOn7wba1CmZdyXzyZyiloWMV9OqB5IMsW31w6WPQ6K/ibTBWbm1PZVqk3VEaddsQbo6T9ynEZnv8miZ66x/pzQwZg== 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=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=jqHBIut/ZxbfJT53SP+F1q1/5XOg6UM2ONcAdAT67c+od0NBJAE39H3VHJG1SWx0ywtzj32TlW1Fd/AIhsGyWwULIsjQ0WpPgHOiFzXGz41QPlJDF47l7uhM5BRFfOR60nmc3R4N2OZlOD9/XhRjUIgsj2lBom2qTdNGz8hJ7zQ= 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:17:20 +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:17:20 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:16 +0800 Subject: [PATCH v2 18/20] pinctrl: freescale: mxs: Fix refcount of child Message-Id: <20240504-pinctrl-cleanup-v2-18-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1008; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=n5zUltymbb2QT8OVUi0ykdiDnyL/KXFAnvLfuklG8sk=; b=VlM2s8MWPklorkSZy9NCPoYCC+X1qhpT9U8O+RJ4UAzCFrQN9FgW0mVCVJh3cOF27q65t8QZ6 Ls7HHept/5WDey6gNVcw0jH5LWh2wGBBfxXZKtcPS/ES2kVoImJ3XLa 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: 4a333ccc-4d63-4645-7e99-08dc6c3c875d 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?szoXTRNoxTcuDANL/avvjllrPucT2s4?= =?utf-8?q?ub06toWixiLjN+2b44KXbOlW3Nz+u8zHbZMg9sWDKEOfCU0ZKMf0M2JpTY2qXe9PF?= =?utf-8?q?MNIS4VKC/JQmwh6fExGyi61fwX+tZISn+VbzoC42ZjUnRs9h/nO9aS/8o1j7PGFdg?= =?utf-8?q?0n4StYGT6GicheZg533jp7UQQYjzwnpcaW8JMdIRooDt8l6Ujb9VNy2X+eyQfoPYk?= =?utf-8?q?9H7tmU1jklj5+iFX21V6KQwtidvAbS/VPx+WYVPUK/Ux6gMDwzeTJsY+QPRwtv+XP?= =?utf-8?q?0bB9pKsWzA4v6Pk5sOQotfn/FJJ0aPluVp9CZSLO/Ou2pJrZfB1FoZtEZnDREyy36?= =?utf-8?q?rFhzefHJ2JPITpU/nOP2EfJSiyah/mISgByhHdsKE2znyU5Ts4M+Lz9hfXvrzx3sH?= =?utf-8?q?sYGp96Um0uF2rXiF+tMSXXLJr3eoReZak/d6mIWyn0wn7G4hwzeyflwTXztznUzHX?= =?utf-8?q?z9EJyyWHBwnF8ISUV1vOJtZtRYjLDyeTmZviWeWa8hG3AxjOTVxczouwBiA/Bmd5M?= =?utf-8?q?JKWYFUYwZIkw+smL+CWefpB10gGZBHn14wTe8sWn1r0giRPwe+0M5KtGVHa/e5il/?= =?utf-8?q?tMT/H6vFEbRquu+pspW7cQAcrBtGZX34echU2sGFaZAF2jFBe9mXLUp0fO9E9sj8v?= =?utf-8?q?p4ux43wqOUuRmx+E7dHjEgPHeWHIGtT6t2en8jFiJ3VIk5oAtyBLtrnPdrJH4Wsbe?= =?utf-8?q?xOvlmzYYCYLSEkrmfPfEjtMs8Ngy9sP11eg3+jzJfH4k9+2eZLvCN2EPqaxBfF042?= =?utf-8?q?fOe0786IbDXJCVe2i4lCqWkM7pwsqFIWNvUYThmYZwi4wKjB0fCqptKsxns215ort?= =?utf-8?q?QzgsWlopL0VnBegPQeaIol1xd1jJL1oWasZLqfuDUX/U7mLG5pFy1zLmVNmHGSV8z?= =?utf-8?q?gDYcFoBJW2zpvkb4gGyZNqZTJdWSskplLZerJxq9twepFD/gEfafzTcs9GzfkkFXj?= =?utf-8?q?s+TOU6I5uPfJrXVwhtci6Ix2M4LmTnmTR7Ypl493fYaGzHxTc5YawtYba1B6XmBQ2?= =?utf-8?q?DzcR4EQbE2+n3AkeFmiOqvb3IvtNavZjLsRWL6ePMU9gax3+IqRWPXgjzHj6tZiZt?= =?utf-8?q?MFdakBBdqANCtvCohpEvBzonGRq4V9fNJkbGulK2yvbDNYwFmTDmAK2h2sc4cGYqz?= =?utf-8?q?3IHxN8eR2mJZftiQk6MGpVahC449L/J0X48bS0VT0yOITtM57X0lhIm4UJZ8hFAwG?= =?utf-8?q?D9btDNnGfe2MNMB49VCjotHMYkIEw2jFFGOThW3A2paUeG9RQqJIA7lE5F525tBeU?= =?utf-8?q?dfn/NpIWiZKv4P8u89a1qenO5INjoactfyJKvsSx1utsUO2mruGz39w8=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?ZUY80xlmj6osCGxyuq9Ra/6hxZFX?= =?utf-8?q?ccuWxoOgkbJ8kSfExgOqKUHfvn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sAzB+UGQAAWKPHHXtOkXCjIQFArqzpDaHZQ1CjHb?= =?utf-8?q?OOuaok45wgk1//je1n8UAdr2eCyWEdnUXxK5Itqrq6C2EC6xu7l9VGBEoJbTD1yoU?= =?utf-8?q?L3WBNCG7EgFMra2bvvUq3PpecLCiZ8CALjBUaSCrnc9lBU+/M9q8kP0kISRoP1syQ?= =?utf-8?q?lzyr2Ftrwp6LsT1BR+XySGCX2y9q2HU0leyZayg1HYhbthzK/wpJcYihFd2QXk+hU?= =?utf-8?q?3SECgEu7P6iX53cpvSt3b7KHr+cYQMc5lCC43kj1XOmSc5sxLnAKPeNrUXR98vNRR?= =?utf-8?q?MbcO7z+GUgsY17xrqY3nPGRj6PX1p/FyFFvNPaF60mJ//1VohtLDh/wzsD/khhwss?= =?utf-8?q?hALKYdxDm8SfJcQx7VT9H4otKNzQoamn7l13bMl6b+nU5Q7zFfnX0lgZvYTTosCLS?= =?utf-8?q?0XvhlO8FVqHQhAjImcillBs6TD/1CH40gy5QtKchvUvidQQkc05wIl9ehHU3J4au5?= =?utf-8?q?7cjeSQrfEcPs4UTZFL2YmhlX+YRsGBWeKcFIsOCUy2lha6EZirdV5m/OcbqWt0E8c?= =?utf-8?q?bryazPvmnBD0A0idvbc1YQ1Hb47JIKzErN1Vu3DiCu8U6e4M9X7+4e6Ap0jTJmqhL?= =?utf-8?q?emodOOEYN6aM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a333ccc-4d63-4645-7e99-08dc6c3c875d 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:17:20.5544 (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: eS0Hqw20bfQUZBCxvAY/jHXjr5fiJodXMP/iYb+b2NEaYZD9Se67ioovz8+ccXYKulvQ7D65SmO1VsXjEHyfdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done. Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage. Fixes: 17723111e64f ("pinctrl: add pinctrl-mxs support") Signed-off-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index aee70fa55bec..edb242d30609 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, int ret; u32 val; - child = of_get_next_child(np, NULL); - if (!child) { + val = of_get_child_count(np); + if (val == 0) { dev_err(&pdev->dev, "no group is defined\n"); return -ENOENT; } From patchwork Sat May 4 13:20:17 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: 13654044 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 401AFC4345F for ; Sat, 4 May 2024 13:17:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id 23F46C4AF48; Sat, 4 May 2024 13:17:42 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id AF010C072AA; Sat, 4 May 2024 13:17:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org AF010C072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kYxiRSbXrlxM0QIZzB2JKkGv1WJuFfsZ5UeNw2hEhj3s2RugeUNPmnruOs3KpMnTUl3wLULJaA9kWr825f0PL1V65U6T2VhJMZNg6Ph0uzezGyCOafoYdFqTRIhQlDiDpUXoQEGJUL4lErnu2rfYTpG+nhVzmvG1aHI3lvEULEOfMiIOVDnLQjkHBRf4LY4rE3vqHoQFP7dQQDVpZQTDZrvPf10iDSA3cniKUGIVHYDdDXKVOSWAzyNS5hYV++eY0ZwfDgQBdvuSrkqtFMqjYwLvMmiRkprFbK3D5aNugridWj1DX/Q806+Vl5faqD4ovOn++GuoFSqEgaPcixcWHg== 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=rPCG6xZzK0LC/23B+oYJdueIO/buCemfRXEoPX5rvQQ=; b=JTpmd+rqr42czEZb91zi5Jo2aSufwuMAvEL7P+ECrNA9kvs+uFlC3Gxy9vxOQyI3sGAPsnd63WdGDUTMPc4tAHZ6sT8MYx7Ggkuz4D18WQyO8t7vyFCMf50L4Gx3wDbm0FtBo5oANfUu3Q97gmLteAKjDQWVnh/gFvZSdvrJ//7knKIc4IK0NdDx+GLzeaHTKfsi9GFQtchFeWOvT+WnsJUjZnsQvWsNL3D/1xHK4kulYh6lfwpVp1N3hvhBTHaEfm4S25JQ2RqmZ1fZUE/cOAlDy3WY35zRWC+CalNrv7abUyspyaH+5c5EVea/DgLqQbj1FeXDUD+oXMCgoIMPPg== 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=rPCG6xZzK0LC/23B+oYJdueIO/buCemfRXEoPX5rvQQ=; b=U0oBYf6uD96SvqELHvZ1Dm4fRhXclJNCzV5vD9LAKg2FJer/qQAgCy33yfbFfxL6OCfoJmrvNotAl9NB5G7lmt08HgP2vvNUlIgL7KkHi/vOcbuwTCWrK0PGMFYkZMqgRM6FVRLBRnpVS9FZeYPfntla8UGRo1RGes+KL9BWCOc= 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:17:37 +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:17:37 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:17 +0800 Subject: [PATCH v2 19/20] pinctrl: k210: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-19-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=1076; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=58KovdEVBZIsn2lfhZ/T0dqiN9oElq31ckJF6Ac0RQ8=; b=Z+wSwh1JPoQAPchmd5Ic4kf6A6+OCSxNrWN3N1KhVLu4RjS5VBGAWLrX0O4aqR9c7Yhj1583S ps7l8SBklTdDPmAjAcjmF7u6Z9ImB7S+gJdZ3GjS/jXZ/LXZiyUzK46 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: 656e3a5c-55ec-45f0-bfc5-08dc6c3c916b 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?/VrCvMeJXuFQRXwKLXMtp5kmy9ufzXk?= =?utf-8?q?nQPBttvQ6TMo5Nlx5UD1h+Y0tz+k3jBcA+EWdpBp6xyDGU6wFLf78K/cQyNwTXJni?= =?utf-8?q?DqT6F42sOlPJ+ddp9uawkarNGh2cAPqd+uf5fzzupPEWA1wUmoDn+yJvIH6g3fPX0?= =?utf-8?q?Nu7LMq4Z+mTtp07nPILUGMrXXsUNdB3zUb9/wIBTEuTqlNgHrEpeB74UK6pBfOocc?= =?utf-8?q?1tsOWY448PgMj3wWLCuYxG+PLl88dXjYBHWD48B9W5eih/Qzjj3Tbb0+tnE/sN6Jf?= =?utf-8?q?UWCX9RyoyghtuKxrm42KDOrheQ4gIYyI52ydjC2KV0ckx/xvwDHw0OpnB5bOLsEf+?= =?utf-8?q?AHJZSVZmnHH9UxvhcO67FY7+B/h3miURjfFSiy2imnCt6Jr1TfjwWYqYUPElidNIU?= =?utf-8?q?z7Bb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EMEajEZFwb+oLPbON/1NL46Q3gcH6TAb6FqxKvSYUCBnoNRSY=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?9rv2Z1vYxrBcb0nKYucoSLamTerZ?= =?utf-8?q?bgXzW0Ex3p72cJ6uU0RowNkvYbhDqx+YpoXKMlYgAqH6SooCXD9k4q9TSmyQ1Eet+?= =?utf-8?q?Voq3QfImqvdNJYStBsDy4UPwpec/id2ObzWwgGiKRcB7BhOn0+IKFlsvHz5BtHIkt?= =?utf-8?q?FXLnIYyY40N/f6Zmt+UnCCLlaU89y2G6iexVe+iE4NxcZ/jXNVT5Wf/WwCGS8+Dv/?= =?utf-8?q?770knUSEVl615PS1JrVRpABYZKALInoJkaDLO3FXcWUhj+ZbrXHEp90zUuLn5BqUI?= =?utf-8?q?WNmbA2OyWu6dIunfL06cPNg2oLD1dEUBLz+rg7KBGaK9qx0cHz5yGVT1ksA42Etcl?= =?utf-8?q?PF1x1A4zlH9mKjLskYFxBuq3ZB5f/MtrX5vQLaCO/uEncKLoXp1apL5uo6WIdbN7F?= =?utf-8?q?HzCLruNt6AXGrqLEY4TGCN+YIdtBLiRw2d0Ia6zNIcmIka5mIMhf2s0ASnl7BnL68?= =?utf-8?q?0HBsxZ+/bA7BZDC4FaoISx5RVj8AgkJVa7GmgPFvLIAHVnOdObZfY/0Qm/SNtS/Cn?= =?utf-8?q?GeY4kbwJihWWwFxSdCpxWo3fT79T7d7jloAO8K5HSEhFU06/e+kYYV8hRGfSH92Fr?= =?utf-8?q?7mv9XqVCtJgGDWO8UVPGUg84o37ScJzT0TP0uv04QDf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+YVBGb8ozJ?= =?utf-8?q?VYfDY99w9qAi?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 656e3a5c-55ec-45f0-bfc5-08dc6c3c916b 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:17:37.4396 (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: g6nupdqB+zySfjS5aEdMaK45BkDcQFF3xV64E9YCjbGQMY976BhNaluoO2HLwNgSGP71nunEjSbX24YIjKnQog== 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-k210.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c index b6d1ed9ec9a3..2753e14c3e38 100644 --- a/drivers/pinctrl/pinctrl-k210.c +++ b/drivers/pinctrl/pinctrl-k210.c @@ -849,7 +849,6 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { unsigned int reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; @@ -861,13 +860,11 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret < 0) goto err; - for_each_available_child_of_node(np_config, np) { + for_each_available_child_of_node_scoped(np_config, np) { ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); - if (ret < 0) { - of_node_put(np); + if (ret < 0) goto err; - } } return 0; From patchwork Sat May 4 13:20:18 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: 13654045 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 smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B8B8DC4345F for ; Sat, 4 May 2024 13:17:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) id A4E51C32789; Sat, 4 May 2024 13:17:58 +0000 (UTC) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2041.outbound.protection.outlook.com [40.107.22.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 159CBC072AA; Sat, 4 May 2024 13:17:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.kernel.org 159CBC072AA Authentication-Results: smtp.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeqS3lzaTiTvvMpQkhxAqx5LXu9Qz5Eun3vOl5nnj8mwXBiR+kPagCszrMCqC/HX7ErnmtqmkeHTlsQl7mCDF5OUcE2weGzTeSDHfeYnp627g+vC66DWr5E2/g0ozE3Oxe3HpjuwAK8453pa3XLNlyrFkMhz1aWOVQXdfoJJSarYTNDNhZXlFk1zo7DHTyvhVq7GQc0xx6AOWV8BG2Z343zDEYH9BJMW4vx6fWZakzmjimLoG0RmF6npsV0ooZRo3KVzUHfYatmil55/XwTirR6IhZ6eddWT/jwf3pcth51hCFg9Nw4lxdARDPsLR4HOLxLpr9s9edGjfYIKroB11A== 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=Ppg9aWlK4+huIGMqna4KeQPNUar5cHCrgX7Io5VTsjo=; b=eSqoOAsUP7zY+Kz27f04NZE8iZsc0ibTh/UKOCUYR1zdYHH2E8lajoRSyA8sDy3HvYin2IPk9R9VINGcz+xnoU97GgyO8xrHjmxu2PIo0KvE6tC7T/CwSOswA7haahV0t3JTAFusYl7ZfoYYlEyg3x/jM8xnEE8NlM9isHl5oWn1cm/Ts8fvWezutcVuUjLsPXSXVuNq8PsDytUlaICnsw+GZuSTWAzjFVSBxhATNrlGrb6xEVrIa8kevPTzME95TFC+O5OgK9hFHWIPZQ0VjhfolUDqh/LI067mWsjVDswRfZ9stebFk4P+850KwVhkLF2pWkabx1CYbNVTUU8lSg== 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=Ppg9aWlK4+huIGMqna4KeQPNUar5cHCrgX7Io5VTsjo=; b=BiuzAJRqpHcg55cTD7Unx+2M7N8+VFhoSv+0CWmFBcYl7Z/WnOM/7NK2dREH09pZnPG9i0D+o39Dt0+CWJE4qgWqLizCKQMOXCFo2BGb5flRUGdzlr/E+bM7i1JWwUDG2zPwHzjuq5+8P3TF0T71rpYbqr3BGQgJwdLA/S60Cm8= 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:17:54 +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:17:54 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:18 +0800 Subject: [PATCH v2 20/20] pinctrl: samsung: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-20-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> List-Id: 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=4267; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Eha3FnaEY3bzUrakRMW1Ov8R+kXDm5JzTBhq10KxbQk=; b=j1GGjC8jOMD9Vols6kLJMsB1llGpiQjkJR5IlNAnfWDcAKwLbiKZUAALPTehYonJf7lE4q/wH yzEqddp4EMID2GMdMRfAxpHQh4H/pYIY+KCEK/dlCVBsLbU5lsfKaOD 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: 88a760b2-963a-44f4-0ccf-08dc6c3c9b5e 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?AtwvJC6/zUrpSsZ6zKp3RcwBbFkQto5?= =?utf-8?q?L6AE6n7fLHXhWlTVvBXlqQu6ey92kjxjDM2x6zaWdrfLr8WKkayeTsOgVoqh2brSI?= =?utf-8?q?luq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q?OsM+2vZEkKm5OTSapbLXQ5zPSnUUdYpATOr1XEMVBKhPEnX8K0fryBUqoTBJJBwfK?= =?utf-8?q?GS7gHC1K3ZkZkKoLeGxeh3B7unYuK1qcJ/IugwDeeCRKRjiy6O3OOsD49JjID1xZe?= =?utf-8?q?QK7swmDFxyGDsRgsZKFxPP1aux7aTgDc1+SSP7atsgUGTK2/pqGLpM6oReiJiigV8?= =?utf-8?q?DTC6qw1tWzlUFheL8AXq8rzInMEc49xSA0bK11dw/VUqtisClx/ysuZsJ+ZatmNCS?= =?utf-8?q?FjwgKgZl31cwh7qwWkUyQ+nyIvTtz3JGsda7UAV3tZnnHHzh8PL9SDhJH/ggGZPs5?= =?utf-8?q?GC+w/F3G9Dmi93I8Kjeo5nj42PJt+NXtAKdRgjYHq9jkqvSUlEv3EhhQ=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?l7dVC5mjZPZI0TQrrAclJB2SDdFf?= =?utf-8?q?KZp1r4UlfpbGq7vOc6GhMaH5PYh3SJjAR29E8DoUiYwWnTFUtzrf+6dCHqSBFruds?= =?utf-8?q?kzNhAvPtlDg/GLvJT15BUIaaUnQZQgeXJAJK8kcpWtjMqKSzsyfyhChrwsxbh0c62?= =?utf-8?q?t1U6vDrk3fXX9DRbmyWdaDHmyZzUAy2R13aWUb4LdBuoNaZBL2zqexW315S4CoMfe?= =?utf-8?q?6WmzACttQewofKU+5uMnXbNIgiRlGGR+jZBfVu4hRiyRzrkeqmrDDyPFXxZVGWBSe?= =?utf-8?q?oA8ihokDhrWNC8OWFgR2ExmNRobSwSM2evZ6jq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DMyTYGgy2HmhaztFNrL5RLo9SgWT?= =?utf-8?q?e7R7NGvWNrC4R82kclbSn+o0oUghcOgK1MtbAhhqfQ66XCYNY/FAlQShIFhD0mZYE?= =?utf-8?q?sVbUjGZJPrnuKS6u/uhy4qrr5TvKhrRsKRKaLMkwpLTv6vzXHG/oOlIwU3fPZNRuz?= =?utf-8?q?vgWdhukf8/B3uCdToLoHPoI3FyWm7JT+tarGljp8HM9PV9qhtvFEE+1b+Mw+QQDJo?= =?utf-8?q?IL7IidwqP8XFJyQQ+RyoZs9Xx/wnogtYifPB1gbMPVR+A0XbFx8w3yc3vT6dSzgVS?= =?utf-8?q?605oxvK+I97FwFjovf+hW2FzdyFTqFZekOOqJL8KyIscdc3CnLZSj0sc2s3iOIgmV?= =?utf-8?q?Im42Bh4c/Evd?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88a760b2-963a-44f4-0ccf-08dc6c3c9b5e 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:17:54.1216 (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: Myzq3/6MY/HfklO204D+tBTrg7YaOAS/vgCDdDbFCJdHIDCD0ERvNPhbgg//sC5GpTgalc5VpfcOuOy0J9z9lw== 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/samsung/pinctrl-exynos.c | 16 ++++------------ drivers/pinctrl/samsung/pinctrl-samsung.c | 19 +++++-------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 871c1eb46ddf..3775999536e2 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -582,7 +582,7 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc) __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) { struct device *dev = d->dev; - struct device_node *wkup_np = NULL; + struct device_node *wkup_np __free(device_node) = NULL; struct device_node *np; struct samsung_pin_bank *bank; struct exynos_weint_data *weint_data; @@ -612,17 +612,14 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) bank->irq_chip = devm_kmemdup(dev, irq_chip, sizeof(*irq_chip), GFP_KERNEL); - if (!bank->irq_chip) { - of_node_put(wkup_np); + if (!bank->irq_chip) return -ENOMEM; - } bank->irq_chip->chip.name = bank->name; bank->irq_domain = irq_domain_create_linear(bank->fwnode, bank->nr_pins, &exynos_eint_irqd_ops, bank); if (!bank->irq_domain) { dev_err(dev, "wkup irq domain add failed\n"); - of_node_put(wkup_np); return -ENXIO; } @@ -635,10 +632,8 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) weint_data = devm_kcalloc(dev, bank->nr_pins, sizeof(*weint_data), GFP_KERNEL); - if (!weint_data) { - of_node_put(wkup_np); + if (!weint_data) return -ENOMEM; - } for (idx = 0; idx < bank->nr_pins; ++idx) { irq = irq_of_parse_and_map(to_of_node(bank->fwnode), idx); @@ -655,13 +650,10 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) } } - if (!muxed_banks) { - of_node_put(wkup_np); + if (!muxed_banks) return 0; - } irq = irq_of_parse_and_map(wkup_np, 0); - of_node_put(wkup_np); if (!irq) { dev_err(dev, "irq number for muxed EINTs not found\n"); return 0; diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index ed07e23e0912..0d4d7ebf7145 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -250,7 +250,6 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, { struct samsung_pinctrl_drv_data *drvdata; unsigned reserved_maps; - struct device_node *np; int ret; drvdata = pinctrl_dev_get_drvdata(pctldev); @@ -265,12 +264,11 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, &reserved_maps, num_maps); - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = samsung_dt_subnode_to_map(drvdata, pctldev->dev, np, map, &reserved_maps, num_maps); if (ret < 0) { samsung_dt_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } @@ -791,16 +789,12 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( * and create pin groups and pin function lists. */ func_cnt = 0; - for_each_child_of_node(dev_np, cfg_np) { - struct device_node *func_np; - + for_each_child_of_node_scoped(dev_np, cfg_np) { if (!of_get_child_count(cfg_np)) { ret = samsung_pinctrl_create_function(dev, drvdata, cfg_np, func); - if (ret < 0) { - of_node_put(cfg_np); + if (ret < 0) return ERR_PTR(ret); - } if (ret > 0) { ++func; ++func_cnt; @@ -808,14 +802,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( continue; } - for_each_child_of_node(cfg_np, func_np) { + for_each_child_of_node_scoped(cfg_np, func_np) { ret = samsung_pinctrl_create_function(dev, drvdata, func_np, func); - if (ret < 0) { - of_node_put(func_np); - of_node_put(cfg_np); + if (ret < 0) return ERR_PTR(ret); - } if (ret > 0) { ++func; ++func_cnt;