From patchwork Wed May 1 12:56: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: 13650643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12F84C25B10 for ; Wed, 1 May 2024 12:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=y0ZRNiZKwJAVRLtUewc2V3RoS4hUp/ac8PK7H+ia1KE=; b=LRm7BPMZmMY8qEpCTBK79yS+mk g5go8GVfSRYCrUXo+GPfIY+tYPDhTUyzBbgHP6+Y4PpnPfAS7xGS9ipkwYPfysHqUOonEy37Ul3/0 tCoqxJsv3hkb9wYrDnC3CmOLohZ7OYBrkKWi3llMTxWyzZzaZvhHlW/JPDU/HnfJYT/dymTySYp0/ NTAIkTtGN1/6KvxjRkX+1ycstbxlh6d0lNZMrlxLi9K0VQObU3FkNlPMbTULRhU32nPaGQ4BbBGFo hQdsakcN3IkVcMv+OEl0yr9nSTANNbHutvyRLbxJm9cb55gy1pK78Rlf5qEBVLSiRpCvXgCsPWeYa gIL+MnXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29Qp-00000009ZjD-1z3t; Wed, 01 May 2024 12:51:31 +0000 Received: from mail-he1eur01on060a.outbound.protection.outlook.com ([2a01:111:f400:fe1e::60a] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29Qh-00000009Zdk-1iW7; Wed, 01 May 2024 12:51:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TMjFbsIiXq1LHEgsA3ixI/2sBjf75yy+EGoA+16wr0ZgFR9rJwfPZo4RxFBTJAWxVrBN8S0Dt+p7fz6mxajEl+WMfG551SNEyG47qfspe8FdPKen7f0nIeO+kF1aeS+hHxz93F3/cByOckwEil9YkR3A6JZpPp/S6Oid3ZtnAG1BTiHDayQGWjkFbtpDGBmXYxn0h9WFCC0AT4tjUeZHZnBrcUeMIC6gKdCcUQGfcgpWROHfU1rgoQhXpNB4ycXpo7jE8jhRWHsozUztvyzCKz1oYZsrBhWB+TYgMcyoPelBmxjg2cMCdgO1Fixc8zuQlFak53Xu14vRVlm/Pd0ZNQ== 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=mbEJJaKpKS6weuAiMZixNk2OarOHo1VXIEj/qtenGtk=; b=QTla+OcFnSCdxck/L1CmKTle95eTf3otVhk9thvnmFz4muwbNDDFC7Rw45tUc/ViSpCh3E1zSkHODoxfDrhKeMqCJ3+YHb1x+nRvd++lFl+ysrQnCgUMuf2yvRrFWEH+p/YCTdByNyxIKFd6OmDAudicMat1sUDZUMMrdT0VkbejHtedWgyi48v99c+TUEmz19IsgPwHteoxVDOzPOS1Zt9k8QHdKrweH+aViMKaRCOS2WqZMEL7H3+jUpXrtmUXMcaHilzPaVPl+JlvJA6OQe9TPsAmcDZjSaL+hS3WtoFuwUALQ36JkVPMKzgORNP3QQHLECTG8td60mTsg/qhDw== 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=mbEJJaKpKS6weuAiMZixNk2OarOHo1VXIEj/qtenGtk=; b=dj2Y1hA5TvwIt1YXYlyAtPCWArlY3X22BcqJTyzgqjHvGQGpk3Jhd0IOOauzRmaC/urZ9KcYRolsLJwiKWc7ECxxWuzMpU9wWlnBoMnUg5iuB2OyYEzEzNSnZwigNJsddfxqqt8jy+/BsNgKmRCcV/Cy5NGSvOfTZTp4P5B+lpE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:51:19 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:51:19 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:09 +0800 Subject: [PATCH 11/21] pinctrl: rockchip: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-11-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=2432; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=6jcg28TPgcdPG2SX4SEdUQ95I6NxhvMbPnDkkfvsxtU=; b=MtxL5cVJ07UCK4MpPHQZwS4C9+vMA6NCki7BU+bDlc/KaaY6OQpFbx6ZDRJWhn8VS3WCdSOUO 5P+3Uc+nHCnBaBLYibo6kG7o4MFExBczK4qA7vKY7lOtXIWARL51rRi X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b9a488b-1fde-4588-576a-08dc69dd65e5 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Vq7SL4sSOkP+QNFIHU9kTnvUKxXv2yX?= =?utf-8?q?aZLUlz5sc1i/Byb3KqsCTn5DpI/pUhYB2j34cKFZN/NJNhw1SGqN6nxgEkOQO5tDW?= =?utf-8?q?+8bR5uCT0gxZTkYqk2M33hTJZkVmUUyG/dq3AjdhwqII5BR7jSHBj77x1C+PxZvlE?= =?utf-8?q?80c5jGLaXwWR28++7S2uDAXdLA7LCXLNBUSiZ1dlEwzHf+o7Wx7+pd5Rn0Yyx56lS?= =?utf-8?q?oWqeQmwgqBt7liYMFeui4W/IM8UfGTsG2/YrXYzc32CHkwG9fuDdmgirxV3Rsc5p0?= =?utf-8?q?RdL9pZ8VCqUyIzsVdR7S27DBfsVdk8vG1MGUlWA4BdJSg3UztvFtyfComVRSPVipj?= =?utf-8?q?S9+HCRq70kUzduHX2Xt9kOqC9eyiDeIsOo+wVCUCyFhSPUgTFAfWTkppZB6aoxTlX?= =?utf-8?q?6SNn7NwlEqaD+fdgBkg3vOobAGhahiNQPPSVaf1zn/8tKwKMMPveh1iCtobz/BSXt?= =?utf-8?q?6nhMjCAutF7a24sMCm9IHguSBN8T+xa/QjrpNjV0hG2Hya4kMABEkZ1osiPKfm2l7?= =?utf-8?q?XubwMYNf8PGBq4BTakkoyPaRL0ejO6Hu4p6JQE+dAu+LzGDVrdH7zuJLdfS4tgU0n?= =?utf-8?q?0pcLVGvUu3sBotzIuzCdN7TKrdjCkw6WcUyHAgLsLmTk33qfeQI0xSR4RHzkxNg20?= =?utf-8?q?k6Fyvf1h+H9OiLDR83lvCuzwjiH+EANWcpzEEQ3wQhNhXAje4sgvXgZZVr2TN0KNn?= =?utf-8?q?nlZyE+2SBYd6JsfjpS1Gf0BO8shl90puLTv0sFlBJqfxgGUnHMvSG/oBNuNxddITq?= =?utf-8?q?zG4Qpu3UuksGd0Of9IXXejWXjNHGaTi2uPduK+3/TzowvMJl7LpkGltEtkHJiZi7X?= =?utf-8?q?Vbu9bja9jnUeNwCoMGyebegG7bGs4KrmTsPaNSOoCoB4EMC074joLpc970jw66XCY?= =?utf-8?q?ry5QtCw9gWRFlpdHxNPANv3QjtBK/2Xtsy9TGe95eAU6p4tPKUOc23gqvfLKXikpH?= =?utf-8?q?YFBTg8nvSQCyaKpPnnzQAMXEUDedGyh0vv38snzE7PyZOtz7rWMy0RuyeG+P8R0Gj?= =?utf-8?q?V3edInMfjSe44bNv+mvs/QoCPnDXqN0uHlAHVKhaIqa76h3oySgjLzjQ0VP5f07kO?= =?utf-8?q?y7/A//enAtoCVOjnfTQVdMezsc6Mnbys6tTIIBcdsfZ+6Xil9QojzWYJyXBf1oHlr?= =?utf-8?q?77x4SjMfUcLpbBTsax8zE6YrTA2qEqpvMO5RZVCqSTAPKZIeq5zinIq3fKlLhOAir?= =?utf-8?q?keOlV0PXdTd5AlwFtf87Fyr+YvXNRpkMzrH5AfU7D5teWgnqeB9xB8qiJOmGFURQr?= =?utf-8?q?zPymJYfozF0BoCYDPTbHW/VHjLGDceOtQ1A=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)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+k0/y9FGomuRqV2nnCjtkJABzKOI?= =?utf-8?q?jCjQdHqVMovTx6JsJ/bzlNoBhIz26eap2vPFDqyMsLgtQYRRksPK2CzyBtDkFa5tw?= =?utf-8?q?QwxYONGXhJWkue37t08fOvgdeZfmUudWfEstjWepORk2zl1E2xhzYJAWyJAjO4pG4?= =?utf-8?q?MhRIx69zGkOOfTmBoQ37gZzVz8lGH9vVkCTU4RiEIQaXXf/KFKQozZWNOkkslWaZ2?= =?utf-8?q?IceVMebCfyPIOI+eznGem1GcHpt5Wbxy9X6CQxp1lrZ8OgTXl6cT5+kiOtmaCMMhc?= =?utf-8?q?JAr3cDwZYBt67MA+9JmT+M3QMtHwunWKkobXih6MQRZMuSTD8dGwoI/FMN84kV/hZ?= =?utf-8?q?cRO5LJPOHVTPWnvS4JI3JhVgCLsuQSs7YJcwja0kZQ/bVnKP8awxKpnY+QDJKK4o4?= =?utf-8?q?Tu6TX3DwZJJdhpeGO+53crNUJSJJzkxli4DO42P8FS11VzXgnhbo0n7anghVnkpF2?= =?utf-8?q?g4bnVpAjUScfzV3XZOgrIp3/przSftI5qeZQG+s1MEo2G0+OxjEHrM+UoOjRhnyjS?= =?utf-8?q?FSDk/usofX84CkLHEy6CFYWfnHVQRXk8UnwK3pFljzkGWAAOf2Ag22ivSAfX8c2UF?= =?utf-8?q?9CIgYldwkgWog6x3hWD8IE/SkUAh7fuQKT2WFmhhr3dMjeVaK2RjZbHzE1WYSoIhD?= =?utf-8?q?//UgddrZNmZItrMwnntPiREf/ENkUcVlGSLUa6BDZZRq/MNW70IUAi0Tbw604feha?= =?utf-8?q?gVkPjYJF3YMkwweS9uJvSn3KeJFwpsog386UQflIXFG7dPUZuIuWvrbdemhx08J3n?= =?utf-8?q?bIpV0he/iAzN20EpPzmWvkDtuqJP6ZWb7gOEOCa77AF3qJ8JU/LA17F8aChs84gL0?= =?utf-8?q?QRnJEt9bFVNDHpfba1h6Oz9atXDyBj1Y/oJlQskM4+sYI7vgGQH28fYWxKgBnLT7W?= =?utf-8?q?CJCtLxT6NadG2WqjPlTI/oMy/pZIfDdtRQ18B+SE4ZGSNiYAJmFtof0eUJEP/6u0J?= =?utf-8?q?iVp0NuI+XpsbyMNlmcQKWkyajeiRE4uazpr8KJr9UtvPcoe98zMU5w901qrx6mElO?= =?utf-8?q?svl/VmmoReLK5jzWj5WsgLyuG/q6y6WKgn0yNNt69BAOe2zIwWAFpWYetXVsC/Vb5?= =?utf-8?q?Mxgd6pSP5p/mdLQs8Gikq9oJ+Adzpt3WCk4g/nLNJnZrRPC2Gkg8qfPA1gyWo82y9?= =?utf-8?q?l2SaOJjGi7aVdun4+AcvpoqQNmJAgwlcjmSOu1OYZktRLzRFykyCIb50CFDU1w2Et?= =?utf-8?q?PXZLuG6GkiwoBwb7Kc5O1ksMAmB1WPWqIEWHND84vatkGYwgAolykZPVrLqP+ve2y?= =?utf-8?q?XV1K6zwxCbXCg7uAnfaw1p/6Ur+2vmI5QC8QrJow/FbWNQJt8Ru9OPosOHRkLJspR?= =?utf-8?q?FwdGqg1b2l7Lij/+r+oqSWlwXm4zRANqbq9XL4FeJ1QMBtIIbsyLlWHQYZ435QnhN?= =?utf-8?q?DMNPTNepihACUxoEoCYTrFXgQEPIC0OW9CnXf2C2fb4u26mo+sklA/z7jAK3jfNkb?= =?utf-8?q?C6gpu3j1rUsMpiStbHYmpLn6tSk5bm/yVzbgXruzAeYG4lYdHeHKkwwsONjE4TCSy?= =?utf-8?q?hA87APg9jrq0?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b9a488b-1fde-4588-576a-08dc69dd65e5 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:51:19.8966 (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: RmREWTxOjqZbA+hijFAivyO/qvvvjM9OO3ILcZmr6eG3JlpsS6rQp70tf6pynNEjzQFHJhBH34gnn98AhHV9FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_055123_578831_73B753BB X-CRM114-Status: GOOD ( 12.90 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-rockchip.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 3bedf36a0019..5c09469c84d7 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -326,7 +326,7 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, const struct rockchip_pin_group *grp; struct device *dev = info->dev; struct pinctrl_map *new_map; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; int map_num = 1; int i; @@ -358,7 +358,6 @@ static int rockchip_dt_node_to_map(struct pinctrl_dev *pctldev, new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; new_map[0].data.mux.function = parent->name; new_map[0].data.mux.group = np->name; - of_node_put(parent); /* create config map */ new_map++; @@ -3057,7 +3056,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 +3076,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 +3092,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 +3110,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; } }