From patchwork Wed May 1 12:55: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: 794041 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2040.outbound.protection.outlook.com [40.107.6.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E1C922313; Wed, 1 May 2024 12:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567726; cv=fail; b=NSxc9AswQVno6u/cMnlmH1pS3AJPftiRNfpBdwGGXu1MKpDIHFxS6O0ztytxNE3HVgLc64uq2z/M1jP8mDfjjKz7f3P0AwFKfQWt3fw8X4kaFSeApSBvCXZhc7KCvX6cUSAol7F3iJOZhhoNlNx/YnSKd5pqeWDmbUo52/gUVH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567726; c=relaxed/simple; bh=5oFMJzgmGVyaM4GqlYVEDeihtJKIKmnMO+5W0gXfuq0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FiHQe5Cop/XDx5O7igQn4NYjiAc72VyiDTSwX1IXLhYu0IyP8AyuD9icFxub85/XggFxa6mURif+Yd7GFFy8xgTozcAmsAL1mBARe0HSu0DSYMFj8lMgEEHXzpBwEI8jPGdNTDckLXoTDjH7RcDT/1tdVyx2NARqsUrMhU4GeX0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=avzeKvSq; arc=fail smtp.client-ip=40.107.6.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="avzeKvSq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jtGqZBS8teDf5x3JRMuyIEblZMUrEOuJmfQMDOrmWCiaMEHwmJx6SDzE2IkbdtpsRjRgUFyGUJ7obl+6lA2ByW6eOwSugT1uD7AzbTBm71claRG/5uPeq5i0/buTwnKGN0mb+ZXRGEAjM5nvYZGGAjMQSX0ecSWZRav6AvayK0rLYQUWTTHuJCdvK74YQmwVjk4TqH9iP2XNFWPW8qa7w/9MqNU2OS4FHif8XqPz8FGfIGD8wZDsir9X/x1DPQLJGKNr2YdCQghJHqAeVXdWrY3NP1Rqj5I5vajmm9QhOS+L/WMCNnjoleW+bUTUSjp4d8DeSkP8piDmFJ8XH7bOMg== 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=CqwszMK70eQVJEA6pKKjpRuI8VkEgByRm8NicNvuM8U=; b=jIF5zYFLfv4k+Ai4BLO+LbHzQhW6gxxMjwhEvjGyAgvljoPw0bzqFq/iiADMHLK4jsJXB8R4uxO8wkPQQnRgAywEDB65StlIBxnXJiaYZ864r28x5VGKD2VOJ4qzksNNGwcRXSS9gr+xbJLJqdSYcbRKmcpdBiDfwo6PXkGvd9jxMkuCD0Hlx8ig9ItEq2ExLbbVqIVWM0ULlWlqQRRSLvfix8dEyUtiaV8HcUHMFFa/yrTCBccbNYXllTqT24TURzkbXh18YCUQXbNkKy9m4JSg2WsVf+pFp/VvUoIoOgba/W8v3faUwG/qapcZNS1VQIoMe9pS1An8x4XWKVYPgQ== 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=CqwszMK70eQVJEA6pKKjpRuI8VkEgByRm8NicNvuM8U=; b=avzeKvSq4PewiI3jQVyUnNS8LbfkC+8WIhgG86jlQtI2C/xzP1qJwY8L2eqsK9cpfGKPicUA9/z0h6CY2VjQBPf10WP2AOYPRK855LWPn1ckp+OETvELl7E7KSKM0eGTCleUahuTQnaYodX6rkPbMm6ET+i9ZnqvwhihZFQdF3Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:48:39 +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:48:38 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:55:59 +0800 Subject: [PATCH 01/21] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-1-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=2618; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=pkkGggwje14Z0jtlI2/3mY9oSznaGYtjsjUTP2Epebs=; b=8nSRZH4j9ElQUUnrxRoZB0IvYaXm+wYHSYfUTORvK0TtdfiFHDiT/ysKV1+rzrNSC18t/cZBF RPqvUMxjmGSC+wCW1TMY2LOwrVvVWQ57ebWbTQL39dBLQuE2mlMTYN7 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: e10ed49f-d70e-4910-e729-08dc69dd05b4 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tZnrQ8Qrl4+9OrOWudSuOkWa0QwIxmn?= =?utf-8?q?8fVnWWsns5pJT35jIlJafpq/x7Oqkq9WjHs+MadS9O5xZ659BoVWoPFmgeSVpqFtp?= =?utf-8?q?Hmvdsd9DWCe0bWyasTXtO2+KDxxyRTbZJqmJrxLHp4DCVN4x4xpCWrA+iFcHQFDfE?= =?utf-8?q?NaWsAGPagYOIA9/ESZLRAFxr+ueD2b1kUPW0QG9irTFlYtVt4psvau+IBBY+TVygt?= =?utf-8?q?DrGvtLV55Sn4wraMavcpDtq11SeKCOIgEg9ci92CnxCfFl4awnoKISdyvTqcLlSwb?= =?utf-8?q?gQnIbLi56rd6pIiWOHamsSV1kjs+eBh4fGDxQk93JSRQAFeWMm1J2XF6u/Gp9sa5L?= =?utf-8?q?SIWQf5fnAUwPAHNN9ec3hRALSwuhKSKxFfYy+ouKlluTh+gMP4dtn/dwenvbvBAhk?= =?utf-8?q?K7Wyhj6rHshlv5EckFVNTtyRosOCGLon2UXFJL+w1xiViWibIf0GJTV4X6A0SvNno?= =?utf-8?q?d2TssVgUfRhMahND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LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(52116005)(7416005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pgA33c0kX2IoJZDaLLDEkVUVD+kH?= =?utf-8?q?KZ7QBDkDtJfaIaJx2P2Xy3iD+sQvR21i/paUhwfokimF2RKXHVYV7Cw3sXOz3Lha8?= =?utf-8?q?TyoVqevCDTTQ7QxstJWsrdwK/Vq15OnF1UsJzuDePrXIRR+qTcxVKXaWAHKMDuXPj?= =?utf-8?q?yE4mml8xqIZZxHlbF+sniPH5Yjgty76txqjqwK9f2Ys7d0Z453qHfS2c7Qd4V4tJ9?= =?utf-8?q?2UIagIec3PgzX2ATRCZviZSVhSBQ7ZeR9dJHV8pipS8KLGbSTdqze95r1RzNWNm8h?= =?utf-8?q?XYK2hnxWwuwABWo6qUXF4+dbPcIPtrAxaFSJeixDM9SENDzIarL8aYddC9ad5DJ5V?= =?utf-8?q?niryCl0sYeHeCbTpsj362yJe56Yp3Yz9H6IH+RP6eiLd5zbTo819pmhDmWdz0ewOT?= =?utf-8?q?Ji+nxB4qkww6saVO7hEiyL8R6vWatMIzhheZOgy5Hb+l5MgIwKPYlLQx2/p7x0FQn?= =?utf-8?q?A+EXeqTGTBe4nm1zh/cvYhPH1R5wpY2zfzNgSVI01calc1sk9dBRL+Q2tLRgFvVWd?= =?utf-8?q?Q/r46yIwG6yZrKOLPom9itnC/oSEI+NIxHpXrTCUhqeA8T6ol+EUT1/lzhHk7cKzF?= =?utf-8?q?4WDcC8oRmurrxZmUDp32suo21ahPnvW/3H1yojluFU3MZfoAAxekCIAnCYvwt8jHr?= =?utf-8?q?qQZ34bYSZadYEG45PbCW/UM4p7R/PGjNFVpguHQf012fdD2PJK/2Nc8j28uHqIqT+?= =?utf-8?q?V42479bDy5Vyw60n2NaiSYTT8CGat9d4HU33TU9dCBvIBoGW/pGWpKAC/EYK+XQ41?= =?utf-8?q?T+QqsKDo+I7sLiUSoziW4kicuhX71WH5odJq++iCggek9FxJRDB9hpg/5Bha574cG?= =?utf-8?q?7VPjx7FOkyZvtyR99mVDdeh77r6nIGCBTDQIyL2Rcez6+VWiM+w5/B8dtE9fh+PwX?= =?utf-8?q?QxgH8ipdQlECVvwlgDp0Fpr3rotsYAL3DjXXvpdqIwCehc8CXC9lcLAtTCN7ftQIX?= =?utf-8?q?WaMugCclysqRnB9YX/AI+5K5Cb/3OMqrTXVWskMVQoN2ud3e3PkAdyyVgyw7LeyBt?= =?utf-8?q?DJPA+0og+7bHebQnbexERA+cQixZZphhx6oeKUE0ZypTZX9aGs0d1WBNv/uzkAV8T?= =?utf-8?q?GsARD8Ou2/HkAyoxDMGe/miPZnCyrqOLR/hCsH3TmEWYv0vhvCbQggTGevxc5XvG4?= =?utf-8?q?OfJ4UBEYsKlUWGBUcsdiWchFvDzXyJUeFgVfv5FdAyNGs/J22BxrpAl6zRdd9nI5z?= =?utf-8?q?yNqpCu2yzBcryRxWKik1Jl8d+avHP+bDGglOF2X+h2PVlRhMx2Nq7SsUvoWme1gt2?= =?utf-8?q?hEOcvO5kufvXTxd7+X9MnFX2+E7l6cTAOT9sgMI7L5SLKCsw7wrcXacyijAylS8k4?= =?utf-8?q?A/WvFHmGOnOEL9E+s7/kJNN7eB0FJJVmoawVd5m1qs5XZsVhTcP9eJePn7uSjxKEh?= =?utf-8?q?QwBnEox4zbH4lKXSMsRUGsTFUJ+7S6mK6SXBzBOCFiAVallvr4+ZK8A6K/Drz7cas?= =?utf-8?q?3KskeoKQ+ftQB8DSTFzlVNXa3BRDD7Xo7DIlSHUn0P9JfUbIyAOBdT+WLBIANIHa6?= =?utf-8?q?Wnmm4bUb6exE?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e10ed49f-d70e-4910-e729-08dc69dd05b4 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:48:38.6333 (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: MwPttC3uQZkaHlw2TbVQNdOen4gRwAJVis6AnSuWi9l3s9tg3ZEut0bJPfwIMBQ0BaFcpI3O3vG3HMTcJVR7yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. 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 Wed May 1 12:56: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: 794583 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2043.outbound.protection.outlook.com [40.107.6.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE3244F20C; Wed, 1 May 2024 12:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567739; cv=fail; b=hg9ee2wCoD4BGlRpsBAZtUYX8CYSn09Rih8TtrPjwdTIuDr4JGKDwZwNbOW7mhtnrosJuxm7rnnt98fhcOrggKbqlkSDPKcU5vhM9QTOvsHErKOzRe26BQZ0KD5qGPDHAl8YeXQeQ6t3VSz4O1Eu1PUtgx4DDJ2hKdwR9m7NrK0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567739; c=relaxed/simple; bh=qaA7+plvN9vJMJd6NUO018HXhCtt4dwNBhkaQZOSdns=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Q5YstgwkhnI+4VD7G/o25d18nIgL9Xu9slabM4pMQzlb2NXjSG5ljuit60Z+UmXcb1jlyC+JSZZiFUUAC5rpaPD6kscFzxT1GJfuY+31ZErEwoPuL/RCFkB5arqpUzTfR2I4IGQ6ZVEsNwPxi7xFgxCRG4siwRPimlGI1PeLjsY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=St/H2kBG; arc=fail smtp.client-ip=40.107.6.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="St/H2kBG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtUM1Zx26FAYDaCIfLxu7fGXSfjyfDqQKjq00DL9+51H8D0XXZHA3IPYETXlSw66QVS0BoVG1oHXsBHdbt/XhMAIypbf/frw4PpOFejJa/Vd16yjg89Ol20W4V1IE4kNtKmDZR/cIMSqPpqmM36JeV0/6mZwR1Dw5kupM9MuSny11X0/+/gossdQveqI3lo8Wjhe89ZlUV/GZtuw6A44tUSqu//fqXcvdX1fs2k1XCZ4yQ46b18dScuPfczImTaRTCLWNqcyM5w3EcShgyT0I5Nr8oTp8jP/12aUFgh/SkqEQtZAzL5NQ58IuQmQbif1WGBTjvnTAN6azSY5evLZhg== 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=fdVrOSBRAxxFKx+tFjA4FVBPMccJECy0Uh+F82a+UOw=; b=O8iZYvIqc2v0bQ1IuXZD62LHarNTgg+Nw1FuIHAOmNvpcnArOCcdoqkKU1JWpr+5XOJETBRgCaVmn/CsLUxlPVM1/qdlHn76Oml0eIpA4y2BhVITYsYSCjYZ2sqI6ro5wrMoF+PrI9a/DAJwOBv55JOkBIj1lKDJrNfHaoN9ZtAB4S/rn55C56lkocHnMYmLdoI5wCr+KmTES1rPTs0Us0bgucFF8JezsMawHk1dz01RpZ2aRmLfD1Kn8sag5UPVFo5ulVB6MEQuwBGxO83x/u7Rr8oANJDgyZhuG/It0aMNhSGAivHRygkA09Bo9MYR2tVIlymjxykcGDSMoRFdQg== 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=fdVrOSBRAxxFKx+tFjA4FVBPMccJECy0Uh+F82a+UOw=; b=St/H2kBGw1IKsi/DaryohVBFsNhSXuGD2J28Nt3bd+SJvh7Ydcyh7dpn4JL2Jbi0VwIgmfoA3mdBdiOhoV9zNowsOOq92DLi53vC7Sd1bGVnf3iXUlrvb4W5x0BhUKy2Xs1pZE+zUZJDqzIJtxqFi7MHWgKoRrHMX8WoRzerpyw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:48: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.7519.031; Wed, 1 May 2024 12:48:54 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:00 +0800 Subject: [PATCH 02/21] pinctrl: tegra: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-2-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=2500; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=HWFw/UIgLMd6Ej1stcfUoXIfV6KFRULjDzCXoqwdlCc=; b=C5u5mDNdj00sFDZuSa9UWjL1tsHbOZz4YakGZqcS0xoSlLSwLVG2R5/NNhIluvh+BjLh8Vf7s CYFLuu1OxMhDtwRO+rjL+B7PKrWEibGnZZ1fjjdhVzBQmcHrpNNLoVw X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: cb754a66-66c0-4c35-06b2-08dc69dd0f54 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?I5OYzWNyBTGLhQ0qI12q8+AsCxdigY/?= =?utf-8?q?KLxxuKhQ2yuZag25GXw0XSOyAmFv9SUrcdz2s4GeZ0FRXD0mwbmsWR9LIit2kcdap?= =?utf-8?q?lpdODHHg4iyoMqP6E4BRaMI4gdsERQt8ZDvXDa14ZtlObqhxvuwbxX2KV8sH8IjD3?= =?utf-8?q?HqWvgFUP4ijs9qjrdr3XDjkg6t+3pNZWnxx9tSlJ2hVJQ0PUXTQNig55+wx8YjOrv?= =?utf-8?q?3sick0hDkwTyubtZyv+bcuNM7DCHTZgeN/n36416qdRZu7zzOkdQjOjyzMmNEmZON?= =?utf-8?q?KuxfikEqmZXzoTG6dlteDxvDazOcuAqjHxmEA0HDrQKt84xZav/BaBQDBTR+C6pdO?= =?utf-8?q?xiqlYxzV58VMDli9EAHB4wWfhKaIIwDx0Wel1/kGc5ZUF4ozWMkm4oOaTwBJQeCpK?= =?utf-8?q?6lb1kYgGZrYj1ChZew3pqptG/dIz8uQINeOJ3vTJgmdR3GJ2ZihqBMC0xYuYwjYrJ?= =?utf-8?q?+HI1DD+P7g9TV3vAjpm/2PTPDtJ7Q5+9257vspIuVQ1Dbs/jhEUmdVSBd8lfem6R5?= =?utf-8?q?EoZChRgX7DWmLevMtxBE35lrMu/tlMV9tEnygFvBAAo33fiHoSsBG0HgjqttkQYIq?= =?utf-8?q?OHTLw5/VaRL2FBE3ShRJUHNgDBOeGjguKvGl5k0xiw6/gSkm2vyGcPRFMatKcgdIt?= =?utf-8?q?wyvNMo2+dWAeaixhllcwxdE3sTjt4Tjn7wSirV9N/irxOmETpTTnI/13to5HR/HAM?= =?utf-8?q?VviYZHB12fufaMIMqKdbw++tNfSMkyZkkW9gyYH40yUD4UggPfxNeYER9scKPY7/l?= =?utf-8?q?SOLCOGBWgAOwgdBjSjJqBfhwXwVkK2aI0H0dHdkkX5kcV1BB7aS3MpMHK2gNB6KGu?= =?utf-8?q?TQbTriP9UOwW+JlEqeUVzezDX5AgUx6/Z0Sv/9Zmmof20/P8LFgPZCAb4OkESl/9Z?= =?utf-8?q?VRdn6dZG7Y8+RNB3jSfEWX7Nc4XuiUhUN/ftxr2vy2GGLR7NFqPKeyeJggsZTKl0c?= =?utf-8?q?hrMzWb6b5ZIwKWbfaDuPuWt515NLS4yCn4mzp41e9xnWzYdTGscEZWum7ZkO47YIv?= =?utf-8?q?okNjdDWjRTfubR0KHB4EiM7E9+uCFcdXZl27rUbMnK9UzwOaG/E8fQemJsUBxZBhw?= =?utf-8?q?P7bUtYV5HtdlD5qlViV1kP2KBnyrEcAxpM0+G5HHWSH2gi0td6hOdgWEMw/5J87vU?= =?utf-8?q?Ppn8kR1jhSC5YbIHdabodCWd1Bp3UQqHi38EbqdEMDU+8hELXoniUUzqUnkLUGSaL?= =?utf-8?q?MkkyoW+kHwCQgAmGC/hNHr1yTrS7DRurvNLqj5Y8PjM6Bs4AQvUQQ96VZRBDYCsCJ?= =?utf-8?q?QxkSqLAiee3ZLgUR8zJNBHyk/BdX144Jr7lIO319PH2tblDoxpvagH34=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)(52116005)(7416005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lnUM3dE4li4XmahbRcUTxDx1bRDW?= =?utf-8?q?eP330aY6qMYBoHdCnhGSh/jrrNs8joaz4/gzv6J9bDjpHEpy6Ne2FauX3LY+jKKZx?= =?utf-8?q?4h+8niF3bLO6r7BJHV4OZXKxMejGLglHdomc0u3CH7NuapAgCT8dfYwEXI2dPw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GMWHncL4+Z3NdU9XGAFugOgYvzJdWf3elq8CLg6LBXSOTcXCmt9GC2CPQ78ddrb?= =?utf-8?q?8R75g3aRha5h3d5KI/dkgJymAAHlMqj7IwZFWbkhlFSI2XTTfj8SP+9mIdYlWVVWP?= =?utf-8?q?IYZ9ebNfa6t7dnuZlECRipz1X5Td7A5f+YKsfBiYEmMrivv5fF4BvAA9xRVojW7Vi?= =?utf-8?q?0Tr2nMgSuA2mW2acPzIkG2MwPljPz87PANUENoH8GlmfhfSQA9MxX1WNf9BxWBgN0?= =?utf-8?q?2zARB45Okv6rCeXUh1Q118syIyj+bLpqyWwGlCeJgHVBZ4bzr1ZLELtLX0ktA3LM7?= =?utf-8?q?dAmmiiNTIQFIjbYvYL1MM+D1JLnOsEktIwN9vcdsb56ebfUEo64Alqd+sDYlIQNdB?= =?utf-8?q?PemiMhpUHjy9hI6e118YMkX9lh94DzJ/DcAhwmyYGt+QIlywDsCuLXjVAtxVR4P2B?= =?utf-8?q?ZlVJNR3E/e8kTyiLAi9ebnq6uGnxIkhba9F/zrAoQaHifRMfEkDZVjjTG4PhdTvwT?= =?utf-8?q?PBK9XJROdLxE?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb754a66-66c0-4c35-06b2-08dc69dd0f54 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:48:54.6730 (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: FT/DQq33uv22k5h2D/q7d0r+R/Pqjofvm3IEi18jKGnU56jr/GVnE2Loef6PhAtU5CmwT2c9e2bct2uKi9tMmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra.c | 10 +++------- 2 files changed, 5 insertions(+), 12 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..69088609a0c8 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; } } @@ -759,17 +757,15 @@ DEFINE_NOIRQ_DEV_PM_OPS(tegra_pinctrl_pm, tegra_pinctrl_suspend, tegra_pinctrl_r static bool tegra_pinctrl_gpio_node_has_range(struct tegra_pmx *pmx) { - struct device_node *np; + struct device_node *np __free(device_node) = + of_find_compatible_node(NULL, NULL, pmx->soc->gpio_compatible); bool has_prop = false; - np = of_find_compatible_node(NULL, NULL, pmx->soc->gpio_compatible); if (!np) return has_prop; has_prop = of_find_property(np, "gpio-ranges", NULL); - of_node_put(np); - return has_prop; } From patchwork Wed May 1 12:56: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: 794040 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2064.outbound.protection.outlook.com [40.107.6.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B685A5337D; Wed, 1 May 2024 12:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567755; cv=fail; b=aClHK9hGL38xU84UPLBYsWxHM35KleI6cViWHHIoCxnj9YJpveAVjD0bxij+sSriymwXQnRO0uGzS+/dlHkwYMF+V2QMv7GN/A+rXwQNOde5h2tOqrcznQwJxOz889QWnPyCaF3wbxRWRp3/7bL03lK++f9NOsuE5sF4syvQZug= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567755; c=relaxed/simple; bh=LSAn+p8fmAs99DQTsjCYGuuV7Smm9Rd2CDUVvdFN+HA=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=h+Io9IrlBiBgD0HCgxCayiE//sQADfNfteftHRIfq5crGQXVp2g3cTh2xpXicbURSA/U8DpHXqT5Y1jGxIsE1pU7HpYMX0uPRr97N6PfE8CGnwVgGn+hiOAc7fOup4rdCkvmg0uomM8T2Il172WipGq73HobUZMVk5DF9/jQFkw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=EmmRaZXL; arc=fail smtp.client-ip=40.107.6.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="EmmRaZXL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oeu47Q+dPv1DPnRVGtc6IiNSPWuUWczHuMJIvx/20XaKHr4tGZ7eStixVLJKlt6k9gXBP+1/PR67tQAMiDlnrHAlpuNWxKdDAF6bDS1NzZ8GHl1UN6f5afpgN3LX7jWR7JOMnH90w8dA5VG5BzgZ7d9lSUkmbJ04GoIHryivbP1QDu3EGjRLivniGmriEkbOKZoWfCn3tAUjffx1OT3WstUpQs8VmUWCQSxdnmuFrLNmrmmrmXe6gsHNPwsG68kwa/8wPslY1o8lpxHDaO+gCofqCdwUNhwr1ov6l8sn1NHkf9pkclPfa2sPQ93DOCz8a9mhRyey486T8N+tbok7sA== 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=ZWbaOnhitppwCU5btaK/2yH59NAaiI69tzBZ/+l5Sls=; b=GRlchT30TLUK57xGbReuKjfzmTSUr9s7OMLTNM7oX8VHditGMqb655tXxxqqGuLO5PZF+kd4uUDc7COHYN/Fk8oLFjkbpZiinCR/rOr2bv8lH6pty5oKDQuQ9v8pIvv5Cn4JBHrvi97mZAf/9d/3xSP7Ts+oJ+6xIuaDRxld72sDAHLRVtTauuMJtY/X57HpiDowhh2Y6D30He09nz2/ShwRJ9/KMhTPKnX1TOBeC03VrO9l/EtbFnb5P+wWOCLa2ClWGa3CcUKgsSnXuz41Cs9e0ERzmkq/AKfmRe/AsLaD65Js+0xvlgf/rzIyvWbx9a1mjSzZtKNg40Iu9vuyAA== 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=ZWbaOnhitppwCU5btaK/2yH59NAaiI69tzBZ/+l5Sls=; b=EmmRaZXLTcmyZ8/Gzn7BfXWIGm50cFWw1ABS/y4xR5FZ0rFwDj5ScpJilmo29x49sCMfAzTWuXKku97P0fc2ra9ASs/2muNOJzKA7Fev155/6SxjfM8g9LIw9T/5jyiKaZSzT28wJ0+x/A2r7loWZu3KbtlansoFo3F/zca20J8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:49:11 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:49:11 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:01 +0800 Subject: [PATCH 03/21] pinctrl: sunplus: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-3-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=1303; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=+m9hOUks1zLp1UolZzmwZ7jTtIojf5UqsPjaqQIsEwQ=; b=IZjMe94P6fYw86SmgQeVTPliGzwM5/iZVmO4VECeHSp9Ch0ktEbWrPRvuWTFTkBwPt2Tg4ElP txogWLr0hpKCU4Qnc8bC8XisL27TbpzKeibh6Ju1lkhyT89QOJTe+0p X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: 065f0460-04e2-428c-56a7-08dc69dd1913 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?uh1koQId+oR83QY+20yvjjCJPccsvLB?= =?utf-8?q?XslFDeOS2/VNbrO6EudoWxY2QCMfxJ2PpxkUXgXpD7Mt9ssKkZp79JHmhmk5u6Z8F?= =?utf-8?q?/PlrgiPe/g/mECAWEISqOs7t1mP7h+g54NL3aDhCPTmvprjWbf5BtVnmztpQqbs1j?= =?utf-8?q?LooAhhAEwsBg3zalFtPZG3hSlpiWSbzrCAIOe+SILL1znhuEG3r51eJfWcU7VPTMK?= =?utf-8?q?fqif5oNkLq37eb2i4Dc8AE39DUjw+orEqj7FuIPEpsDfeHGfRR1rwr9Sn6gLvbo1h?= =?utf-8?q?aidl79/Hc3aCY6qNt+wNoGn/KJpXHWKd+jNCNV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PJbTVGbjfdtbW33HBZyrB/Du5dPjih?= =?utf-8?q?ClJx/sqxRqd/61UjiWwoxl2Fzntdtd0YNZS9qkq2w79v49e5i0t2zP3yLRDjoHPsL?= =?utf-8?q?d3WW0OO2BIZAhZQGvtv3UCC1vhaTalv4F3aFfhdRU5kwAIVYGktXVNPU=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)(52116005)(7416005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Fw23i56IibsNYGpMknTSwdYwALQb?= =?utf-8?q?bjm6CHgzG46tpVSNB2spp0/doB4FPwZHl1bZreRp2aMrhWbaEH2mHJNJPm1oAiKFX?= =?utf-8?q?GimzZWVNblHf5Z99GxhoT1bSPMwttIeZw8lRTGK4bIKy6610psxens7scUxlSsY4Z?= =?utf-8?q?rhcWO6cQaGmvhlBtBSUnUuHrZMnk3fGZ3xssi62IJQ5ufneNOiRhF3yXnAxFn3DWl?= =?utf-8?q?/+sBeR7y9FONPGr4nFclg7+b0IlvdiRZXIzKn77qs2T/j3etlcQ4qoTA7NLNvkv54?= =?utf-8?q?/VO2xj1jaLbuJDQtTMfFBbnXxn2UJDWClf82UyiAZKYS9UhlQ+V7kQDPTK6xb75R/?= =?utf-8?q?6rXgieY2aKHZ7XwBi2AGIYgeNmq1OcIBBoDZ53cuQrTE1YiV+ZDsMjKxJdVNDl72l?= =?utf-8?q?yGjkRGy6utLK2eK92exhjfgWtMCUlThEUd6l1cLznMY894fH38TOOY5TAN675wNYG?= =?utf-8?q?hJXidiHwHcck/TdLC01Z/PEVU7VHfo+Hnu2TtkRNPoGin95yUPUQ80TM39BVMc7Ls?= =?utf-8?q?yicJwyQGUgSB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rtIVvEBXfjm50Q9nHI3B9qehCiXzZV+9XqD4YXUp?= =?utf-8?q?YO99iQ4lrrsLroL2padmuX4Sz4hR/7fOlzFZEks3QFelQB/KV4o9PpH8nE3WoGiTx?= =?utf-8?q?UR1vvJ9wtWDC?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 065f0460-04e2-428c-56a7-08dc69dd1913 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:11.0055 (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: kvq5FEOPiyJ+1kQ64iVQwxsQD3eMnMe+tmTitUmgyqQLUOxYlxzgOM82g+xPwvaQXsBROZvmNsKkMC2YFHNfdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/sunplus/sppctl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c index ae156f779a16..604256ec9079 100644 --- a/drivers/pinctrl/sunplus/sppctl.c +++ b/drivers/pinctrl/sunplus/sppctl.c @@ -823,7 +823,7 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node int nmG = of_property_count_strings(np_config, "groups"); const struct sppctl_func *f = NULL; u8 pin_num, pin_type, pin_func; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; unsigned long *configs; struct property *prop; const char *s_f, *s_g; @@ -964,7 +964,6 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node } } - of_node_put(parent); dev_dbg(pctldev->dev, "%d pins mapped\n", *num_maps); return 0; @@ -973,7 +972,6 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node if ((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN) kfree((*map)[i].data.configs.configs); kfree(*map); - of_node_put(parent); return -ENOMEM; } From patchwork Wed May 1 12:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794582 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2051.outbound.protection.outlook.com [40.107.6.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D1701EA84; Wed, 1 May 2024 12:49:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567772; cv=fail; b=QvwOACNGsLbHZRgyWdzQXGvyYd+oh2MyE8NKD2uKH+E2U8UEkqrWgQrIh0n6noi2DlazwMj6hc3EQaIGRPR007Pxk+MjpKEhF/kKaIWvzp0b5wc9FwzKxevrVvPaSI8Nj7rlFLr0HlVdC8xn2oUi43K05ylXe1j6yzgVReKdnZI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567772; c=relaxed/simple; bh=T8RPCLVB0venRQNxNQUNK7eXrSySPXtqqefcl0oLISg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=cqcDtdl/WeL4vN1FuUg4ZzJsYDzg/GMYjLZRJEGy7B99VpL3UjHROLLvEuvw7mzZXEDYhFFgcDaC6HeSHmnATVYCwszNrfbfYzJV4P9P2wxIJgSYZWj1cq0jya2ihmy4T2lmtbXWGDVoCa6PmGE9J0goOvBJcsAGoZ93XFmpdmQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=Kqlxeuda; arc=fail smtp.client-ip=40.107.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Kqlxeuda" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cd2pkTEpxdjR4zHMJabEAK8ziMtPIJdXtnU2NZKH+0KI12XRklQK+DhQtJrRal59uhMEX9bifoohmvgy5x2EEFMBDYLWc0hreM2/HuKM6hipY4VHs1E5IuP69ZmbdMBk79aTnk43OT4jIiE8RnvutU6tvF8E7xIgMIFu3ISbNh3d2BLLA4gcmr4vSHF9NMRwF+ZP7Pi5hQU1iInfiojmpfDvkRnk8OglpS1yTeP6md24K9RxJ5U8S/Ljzs4qfLmDLU6qXyv+NyB3VmsJclpp+B5DFx4ngrVqzzvLvcsxlnfWODpBLAdlqTHHHUhLf02Y8ZevKWc9/xOmTOHFnk6zvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WgaCub/AVvrWstgRn7NDSa3uLOl1yukaIFVzxzPeW7I=; b=EhjlbkSwIpK9p5mi+T8IG4fJMmy3vM2r3qtAH+zO2GV6i1EIR0hj6DvE75r8/pNWdBh8M2gBbUvgvYvRxHqQFwETfJFXyr8NstOe3KlDaIwXGu7BQkNLDITjPC6PqUqqlIEhti7JjZLntybbY+B/96ft3UN3DhmT89ZbintLaW52oZuSNsmWfcOIwwIIL1vby/qgsy2AfbWbiEW1HCac3xC8BMKYhRFoNCqZn5E4ubYaJ0R8B0cFwqshVjIEXN2s4zLpOTI2X7rat+QyxUxL5s3o7fW/XS7Sa/6Q3zVjBeDIQ0pMir+I2ACkYrpmKHI1Gx7IYNX8RXkWZq0XezQ9Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WgaCub/AVvrWstgRn7NDSa3uLOl1yukaIFVzxzPeW7I=; b=KqlxeudasMTvhe+KYjUqTRiD3zhIewnGUP/1/6FPzIUOiA7oIwOjMAYneE8FW/eXrC47IYOR5Id2saq1vXi4EVllT7bKTH9SciPp/WSRBpQEhmxx98G8kKyQ8xHo6utAnI+1zI/YiPCeNB4NpGnYXJgg1/3kf6F9AqjO0XWHZAo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:49:27 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:49:27 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:02 +0800 Subject: [PATCH 04/21] pinctrl: stm32: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-4-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=1839; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3dCftRoTOrOimvH/zZhm1znYYmC195eNUPhLJhk2Pd4=; b=fEVszNhFmB0ozWSgviQak9c62GVC/GEZgZAP4r8VCKSloHSeg9ffm1vWAQQ+bwWtefd5irQb/ 3aoJSkKQVp/AVh9+Sc4htbGVlXth84TcdldSRvPA3MnRCqG5c4wNNYL X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: c222aae5-b13c-4c9e-3bfc-08dc69dd22b9 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8EVjt68Liyl4MQHpZasE3WHwiLBPz9d?= =?utf-8?q?C6KvdEGa9xTBM2cCvlGl5yrvVkRdr3abjbOUCvbzTUl9U/3GcQjh9CYfVh6w+NYAf?= =?utf-8?q?wocG+mzeI31O411UQprlTPrrHsxDSFWEq7K4xo1NmqT+zVSfAKDJxAxdonCBrpd5P?= =?utf-8?q?PxMPsKzGBN+PqO2EfwsAK4FSKMVYfGHxecXsm+Y17zE7AbNemW93qJj4eSlauIZt1?= =?utf-8?q?R/MN+7KmAz4O/97HwOA09rniQAhasgV3ylarGYijtM++jHsA6tvPbZstZPsVoHBq2?= =?utf-8?q?VLPLHE5mtRfqr7YYkRWeF/6plSGIdTOO7WsuWaWUyrujQ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GkPjmbhEYQzSXhr/1Pp90Nf?= =?utf-8?q?IXNrKO+MUCei/M9JoqIsJ2Xw/i8fzl82wqgzDJELDoMyyoaW3pt4ETXoodJpmMtlN?= =?utf-8?q?0Rs8f3iS3VloCd3VvhAySOIaCBmcJo2Qfwuys0yy1oKe9MuEFAOI8snE=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)(52116005)(7416005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?6aA+8IVUEQmdvCPTyFKD9polhzx6?= =?utf-8?q?al7RN2yf/7WiOdGpoEIiRGak9CPqIrfj0DtQbiXbiHGrgXChBza9lF3tc41IsHosi?= =?utf-8?q?o4uoy5inABAj4N0F3gfbSRz0XR4+j/84hu6Sqt7XZWxzGDm7PHRJ5sRqlNtV56g6S?= =?utf-8?q?Q/hyBl69O5dXvz/NETAq0pFb8672wRj1noCtV5T6qF6Lxed4SXf2cTzjYx8+CWm5G?= =?utf-8?q?y9DJ2dxeWeNhtq4vi/rnVA1lhHXJ5DxjFH3ja4fwTRUplAgXlGbJJijbe85akHwSh?= =?utf-8?q?FSP9si4IMnY+P95gVD/HBYEAE2Ql0nT2xY29nCM0NHSdWao0Wakpxrs38HDmFmdEe?= =?utf-8?q?JTqMk9yYItQ17JZaduqfSDjkOa/SZnCbO1O7oMGbzLn9hc2MT+TqyUz4/etlFAG8r?= =?utf-8?q?amOpjQcq80hh5y636ziCKGxW91x5g5fWDViZ7h1HomPELTZtOqAr5kxytvSltUoUh?= =?utf-8?q?LcAKUl5LIfZJNCCU0WHqmE4PRRvjZc6rj76geb6sCAI7hSj/ZMlC2D6JsRWdRO4PN?= =?utf-8?q?Z8edsMWc/OL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o7Pw0UARUlVNeyqomZ7v+9xo+YVv0?= =?utf-8?q?vcfV50N4r03HVn/3fMIDrcGzHB3Lv5mpEAXNGubTnQIXnwBthbqUnNSW26EE2r3dB?= =?utf-8?q?OQn0swugUaaQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c222aae5-b13c-4c9e-3bfc-08dc69dd22b9 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:27.2054 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gYhhvpfni11AYjiQmPbJI7VN9cJiU/58D8H2Bm9JL6Fv8mo+F82kEz2zeToWO4luMT6owRB/C7fRHw0IinuiLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/stm32/pinctrl-stm32.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 978ccdbaf3d3..ca163a91e724 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -670,7 +670,6 @@ static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np_config, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -678,12 +677,11 @@ static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = stm32_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } @@ -1401,7 +1399,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; struct irq_domain *domain; if (!of_property_present(np, "interrupt-parent")) @@ -1412,7 +1410,6 @@ static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pde return ERR_PTR(-ENXIO); domain = irq_find_host(parent); - of_node_put(parent); if (!domain) /* domain not registered yet */ return ERR_PTR(-EPROBE_DEFER); From patchwork Wed May 1 12:56: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: 794039 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2084.outbound.protection.outlook.com [40.107.8.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 763327C082; Wed, 1 May 2024 12:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567789; cv=fail; b=j12Wz8GUS2p9JLSgpng854lwNdSa5u9FwhDg/llPgjFm9vqzfIWksuL4bHX/kMM9jgD1syLON240sg4EC/LtKQt1U/ZNLpEG5bn2xb3qBwrNaN6J1RrTjh2pEjJUljFY283KizvtL8F2w8yFW9oRZd4i16i8mQBSKpymyXE92Rk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567789; c=relaxed/simple; bh=ZoFezlHrLhNH6VNyCapJyxPF8IHiuhLM60d0IZaK3P0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=LHePeHmxKTGlYRMFE4WSzGzwkiAwm4MDOktUrY4+kX8FBOW2HKI51MMdTvazn+IBXlrr+TjkGtRdBpm3aq3oX3w0k1R89w3b7VqL1VNewwdWTcVNbx8/AVMLQx74zIG90xoTt1mWO/NKp9rBMS+dE15J7gCRFeLY/inO78fXfOo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=I4jnerqd; arc=fail smtp.client-ip=40.107.8.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="I4jnerqd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ve29h5h8BcMVkb+1Je5Ycjsz2hAQoJQAfcpoCPU02rQDiyi6eMWbgVqmiWH4CRT1p62sO9E19JP4f25oOEsmIHGpAz4ku6WoIq0YUio1YmVW/b5ARmtMuVhdRHK02wVhdfAWpZAK0nJ5DQxIdNYzvXifSpe6KGckHIVHXoB3YNhXRGwHyjAgiHT5gK6lKdqVozw+aJyCK9KvXfjvM8hn4ppfeZyQf2IguSj9M3b7hQZIMw1a8Z67jLJkG49b2FU74tFuugnZa/QV2Ig7BGqdnZf8LQxATKJCYNgEMK4pJBxGfVeyapd8HpLIISzOPdCv+F6QbyvUEysCq8lkLCbeuA== 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=d9YUvofIdVB4JzzWI0NRmFDL50mIRPG79od9oDhnF78=; b=PPhfLsW7SuP9/IvAj5c89Hoi0/EXWbKMLgY7B1VIvBQJrSFz+yJ2h3I8OCIEpR9P5B3upMAK7wRGfRw0cFThZvo1dxhwm1ikWlIID7Vu4U6R8qCOHKvZLejQf90xt/PX8uVOPJuK8RcUWMJ5TV6NquI7WSVxAp7yESb3PFHSv5JAH+tBc5DBM7NdNxdFWdE+TkrKQUX4mln/1/8+o5FisgMwQP2BXPm5qEyX0207BsDr9GVsWH60V3unBlYZQtailGffEbkIA4KD/mko7Q+RiBlTDJf3y53dCRWEEgsPRQV0MqmXePiV2RxD/URSZQmE+APkfHC2FSEEek2Bc7y1rA== 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=d9YUvofIdVB4JzzWI0NRmFDL50mIRPG79od9oDhnF78=; b=I4jnerqdQYo0PtLUHhRdWVFBJn9zKyabdPh2sFHr9ErIfFjM4EJAx/AfwpKuCgOWapMfbTA7kiB2d7vu2v23jbN9ACMwe4V1EEew196pVQLukDvdMKqca8QzxuKP2g8hk3SCMyOwVFL5QxYNdnE1jeZcPCkC20Rc0O7isVHd8n0= 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:49: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.7519.031; Wed, 1 May 2024 12:49:43 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:03 +0800 Subject: [PATCH 05/21] pinctrl: starfive: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-5-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=6656; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=q6W94Hjdjjw7xg0ybaSa/7rYn9TOuVxzheASMuMVWPs=; b=oeYu4Ud4YU5lBztSso/rf0zqe1lgwaHPiuNrD5LA72yGh5Bng1xSawl8uORrM5WFZwafQV+S2 Y5SNiNdKNvaCP9Ni25D/AlYfbPj+Btc+9YyZx4MFETYbweNVA8teD7Y X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: a0db37d7-54bf-423e-011b-08dc69dd2c5c 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?oUCenlbZPPdCsuS0TC4XsecKdLSrq8U?= =?utf-8?q?ICKFMXROKOoFXZmQNOHynLfXAwY4p+MpGZFVFor2yCos4zcOhqg8+PMeoW6X4gzt+?= =?utf-8?q?YR2GX5sBER0bFAV3qNiTKW0/9iYDKHDUIjJ+L1IF+mkDFf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8RJGQtS1X1?= =?utf-8?q?sdqycasFnznQ2i7wur2GquO0kb4Q5DSaHu2ceeOEZ7cNSZ1ZqWBAeDE6rf/4qMRRv?= =?utf-8?q?6Ea9M9dUivcY42vcFdDwwojMpy1D1NrnJQofUyzQXTLjA5nFxbX8at89z5GyznEe8?= =?utf-8?q?mDZqCzOueHuD6QPEweJUUtfOtNVIDBxIP/mM4TwksSWnlOuYWy5YI+Kr10YOinBXw?= =?utf-8?q?YhKZqdFQXUWG6xFA7j4bf37AKcoPA+0XtF6jGrBlgQrjppdLjbGQFmYOdjNtv7NaJ?= =?utf-8?q?NYGGahtf3YPPvdkChDVbwWprVTIWVciAvdMeLsq30xVPquA+1HH1LP6o=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?jtzVL6ZIIpJKMXZw8f8FZKflyBTw?= =?utf-8?q?O/eaOqtFm9eovq8exIJ/Qg3SgXoUG0bjWGazuFsW/OxAaapBdXmtk71cp3geBU5RE?= =?utf-8?q?BM5nw0KYiFguW87dnBUoUWhIAYvl7wnXzO41SaQocrWEcyF42uahpLn2FuCHMv5rV?= =?utf-8?q?+ksGWOtNOOCXr68gjsFM+0bwDI15zQ3sFmT50gd85UZ2VtY4d8RS1w3VK1uU1MUm2?= =?utf-8?q?WhHXnFpZ5i78H+FtzjpDd9QdDlwUU0OYFovm4Xl4ba+Oh3MQ8RY9KiE3LlguJ8jjo?= =?utf-8?q?CmJ4WX3QNybPL7n9cPsvu7wNFtVsgbUgEU3sqGGp20egwMytqSg/sXfQXpUXMEf6n?= =?utf-8?q?I04FaZioTxrVdvEi4/0f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pkv68yk8pnPZgyZqjDDR2UU5xO9zwYtHvaB27Gtcx3OGnWRLAj?= =?utf-8?q?YOPY5rTNt2MNuuYn1+YZbBPp0Jtnh6VDBdcaTFvVHFbFvtxWZx9rdSoLqhDe4PTiN?= =?utf-8?q?doHY0n3drgD1MmIAzHO7hYuE35M/N3z2U39IURAeWzf+oOzH2w58R7/ip8VBJGRAn?= =?utf-8?q?l0IBZyKOv2FsFm7HKtD7oiAQwgffwLjUrQNhgCJPSU6pEsIdO5GMwFo4zAgZIRH3x?= =?utf-8?q?xtFHgz/MGC+pBGdP8b+cy3Pn8uqmiR5UKiUqSPaNPIl1rfbHOlqV5bVHTcyqbxmmb?= =?utf-8?q?CBdje/rEAAlR?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0db37d7-54bf-423e-011b-08dc69dd2c5c X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:43.3920 (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: a8VMXjN5tnTZbVk5RTJATfV4WVyud8UqeKUIyvYzYSsszFnA3M3VjRSQ8h35vE1kbq/I+796vLW9oWOt6tBpLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Acked-by: Emil Renner Berthing --- 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 Wed May 1 12:56: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: 794581 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2041.outbound.protection.outlook.com [40.107.13.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6E1F1EA84; Wed, 1 May 2024 12:50:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567804; cv=fail; b=ENPlDDpJ7vqJTbhzs9lgI7Pu+1iTVtnGC0cLS7no7Cbq2Ke/Ijw41cnFSx4NyYuXiCppjhEW73b7V9r7mN71aPrd9TMDP7a3XR8xDOsGlZpBZxRQeVOF3PyEP2fzgLP1NiypQFBdOuYER6/7eGPh72aa0rrIVEb3RCBpT7vSZT4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567804; c=relaxed/simple; bh=8+3VXwLUrYD3nDfOr7HntPuhh41zJEyci3faFCn1b9g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ZKPorfMwkw/QXH0MmqK8z3w9BXt15W9GNKDwcuj6lEKDbsINB/H3D1XEm5oeBE4Ok3AlwwzxuupJME9SeahbP8/KfoqTzY6it45RY2uFl8UU8RnXz4QKCKkGxNnbrvl5MvulN5TMXgGaLzlSvN5kpOzwu8sGwESKlVLKIiu8qn0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=mP2fBb9I; arc=fail smtp.client-ip=40.107.13.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="mP2fBb9I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lhv1eTm7xvunKW9nrQbYUw6o64/7RgXliZ2QCHTS2bxKvyHLwGFdX8dPqYPu1CDauO46kyGkV2lBJExChqWL+4+PAak0QMpvgTnwWB8AFNItcVpNEB8aDVq9mU8s5PLmUhxTpKWe4MWkf/T+Qy6Uz+QDfqQPC8v4QdklsHoPaQj2HPzl3EiC3GtD+WsKnayB2P+KLLyaPq4pPpGJvwWWWroYVH6fSe4Kld0KBPzn61688C0sZ7mFY9N4Wj3JafYW8RuOyoYUqoMJPa1z/DkQ4RdIajWMAq8dalZJlmmGNQ+9L+0rWt21ifKfGSYZBglaCAHlYHFxymjUGEyrMrlWrQ== 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=kB1mwpdK6vW/OhPu1g5ZbbKKvNxrjbcs55N4d+z5FtBYh9KUvOI9mjriAdo9Skj/jBM38nlr+Sn3qSlGX7nkKcksYEwDb4znJEMUlraiUbLiFCIzWhxB5mO4XVeq8p674RX/Gki01hBCd/Byo+qrXszWHM46QPFjT/MwhZfjWzWKmYTA38Nvr1yeNFsrJ6BBVYkAmDUVpI7Hjc9YyW2Jtg7tlsn0lbIoM7jZcmR7M6quIFev291wVv7HH8LIpBoN9rOSsyfzripn54xlFpTxULydO7al2z7R5FHt0PmBBzBl5IBaVkRayXn/ikKDBhqQYxpuYHIwyut8M1fg3kZDCA== 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=mP2fBb9II0l3GeKaliashAz8NJejLF3MK/r6w9BzUaDj/X7zXYHKb9x7HauCtaXpmfJo4FZbTXSn7gjfjmn9uRwzxSaQkiNJEtqxirHEfdcLS0A014uAFHK3GXynGnojTaoEziZLFfs8+i77ybXaQH37okheUM/Xg4Y9+IgXUS8= 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:49:59 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:49:59 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:04 +0800 Subject: [PATCH 06/21] pinctrl: sprd: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-6-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=1540; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=BMqLHOrX8EQjg9Z3uUGPLv8QrQVTIzjrj8QOQ3y5znM=; b=uzJS94q3JPQHLA5Dfym/hBeiB+V5HFBQEhABQJBlklJZsJPGzVQEg5YpRg/g13KZh31C77PmN EFur8rCNveRAK/bhsPtw3a3Fbhh+KOPCez1GBrD/0yhQsXLFPZg8lzr X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 13bd78cd-48a6-4e37-ac13-08dc69dd35f2 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?OnqtqR8vLs4FBneMNgR4jcfKkFz4uNe?= =?utf-8?q?AkMhIoRnUC4GWmY5GFW0ByjTYZ+fkYbBokuyO0YMNT/6A9KkYG53yikYVAJWfupxQ?= =?utf-8?q?eGPMhVxg2j5Bq7rA0zdjvcnUb/xcIoiElq2NQEjz5Kj+tKyTns3DjE7R2lUxDAmay?= =?utf-8?q?7Mp8mpr2ahTWZ+sv+8hjPzh5Q046FA/aRd+a+20JetkDjMzKj5futSncW5bLpwA8/?= =?utf-8?q?7ZgCrpfxCKxYkdMl3RbBAaiTNfvgHnz+nJSrT3F26m0fZXvwHs/Rxfdsu70PuOZzR?= =?utf-8?q?s1EPujYNYrC/mIeo9vAVJ2aD0UyFffDlbzOlpic56vCQQFM+ESq764atz2IXmAD77?= =?utf-8?q?EIRkK+WopaA/talzPsWObPLos629jSQo1V5xBjLFTt1oQNmEXY7OncMyYciZVg6Wv?= =?utf-8?q?96oGq5ei8CUg5r4egAU8/u09THxaceK/g0wC7N58jXr6lrcqfo7ZuNYPDMiQfXh1/?= =?utf-8?q?7bRobp/tTuHjg31vV1IEsyapUpThGz8+dJ9BjxqaVYJdqlEYMDHCoHkjjXBQ0XYga?= =?utf-8?q?3TEX9/EX9UVfdJPzrNIWTEyZplu3UOHW9SCiIPi/MpC+WksDFIn/kkkOdqwlLSzOx?= =?utf-8?q?I5MI5Lazb5rVpl9Bus+m4667UosuxusGxCdUY+RrfYwBcwIMV9V8TUJ6/6Ms6VPAB?= =?utf-8?q?8ue7PplUUUoK7xyk9lWBn4lWBFRiGkqZjommIZaJNIw7bfdsBD8tljxxPSNWR/Pfm?= =?utf-8?q?iUdwm+PURT+cHVh/aXPm1FyIPpLNqnEHSXxcENiGa5pcBnO0CrAxR0OwwgWlY5ARe?= =?utf-8?q?YT1MUzX4+uaPEcJ0RjhJKxkCKiF3TJ7JY6lg2KJJyVGdzaHbBAuOw3HklFEziPDXN?= =?utf-8?q?onbVf4QmEsGAM6f2SAtPLqBbsAq9fD70LI1G1RmzQn2g7RDUOPsArcguKU5Xo2D30?= =?utf-8?q?5WhFXVwnMGEwDmy1osup9beSAdhfaUA2auFdydQBa0YfnR5iYJrWI7kpmtdDcV+Sn?= =?utf-8?q?v1gzGNhbrdDT+B+WFmuiQKmakyDz4wwrwEHbiOD0d08nNks4CntEDbkZPIYpjWF0o?= =?utf-8?q?kapmeGAAHanYvRnnkdhQsqq9QC0QDYlMcE320v0mEfoiEa1jD5f9nxtmz9/2rgyM8?= =?utf-8?q?pvOMcROvt3DxotQ7VLAJNsH6jYfKxA3nZQOv0vIkR/fwKBYZEOkEzwC5/kZpJ5D0K?= =?utf-8?q?dtKi8u6cWbyedfor+xrdJzhrAvjnh8u/JmcAPLDqpjUleF8HyWZMwlhlz2O8AFxAw?= =?utf-8?q?Oqwrynzp698/DOsyDu4DalKzR0waA+OUw6e56pKECMRtT7J2F8TwKGnckrbY8NRsC?= =?utf-8?q?THl4+bPSeCLzwgAflhsv7YJxb4LXHRfyZiQiZTyAIZ2iQdkdKxJlaJQs=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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sNvIlvB07SHPi4wZBA1cFrdCE5vyJ1ik5Sm7+C8PIIsZZCdaPi?= =?utf-8?q?xArvNpWv5V3RlSlVyRYMt3XmaJOgsQth8J161PMblOzcR7NC4p/ksoUg2ghYJ9LV4?= =?utf-8?q?ccdQd5ugd70pLzACbvRSBqd3EwS+NFxL7H/frcdtVqhGJ1X22Td8i1RIIEfFlLWZ1?= =?utf-8?q?5pE0hlYTPpW8Il1Mu726YfnLuSrK6gl7eV7bkMcyQIB3OwWfoCNkxiW+VFQbqQ6lT?= =?utf-8?q?PeDMNl0iw5R8ooajaBcRlyrTCEKjCksqJ2CzZvjA9+JuYSrj++UmGNlbNaSjizfyf?= =?utf-8?q?m0lU+RvJkiaJHsHFI3mz4K3cUHrFjLJIhh/ag6ZgSf+aq5CUxfTbWyJdNoFVOMUDr?= =?utf-8?q?DeAE0mh7aUrfM/K2iWKqxTj0xwhzzDXEYidBIWftimJiZHvliHdg2RLqWIqskVzJb?= =?utf-8?q?Uy54/PmWQHtqYo2+Whm3uXgKZFO4ltP7VCfx7OckfDsqmRwtjz98r2wiDnczBpP6g?= =?utf-8?q?dDkLiFYw9DnDd8djnjObmRD6IIBChcfpa9Ovehb+j/FkSqc1xd0C7ZmR5Z51QMAQt?= =?utf-8?q?79VigI5b8YvIKpAq6PppjP89ztsb7hKvNW7praJKvErC0qxO0NI7LqW37VePUyRCu?= =?utf-8?q?H6V9gGbexU3BDp7Gx8VqKaWTGeS98fBFbLKWaZwRcuGYgOfoazcXojaxbn/DfModT?= =?utf-8?q?kmMKq5aeVstd?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13bd78cd-48a6-4e37-ac13-08dc69dd35f2 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:59.4572 (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: HQwUUTKPiQihfGdhaJ3Zux5//CziSv+w5sPrXRinOo0DZZHN5lFE9uUBlB+TKIp6YSfoLdBBKWRlLQOu//Ngug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/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 Wed May 1 12:56: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: 794038 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2080.outbound.protection.outlook.com [40.107.13.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE8DD1EA84; Wed, 1 May 2024 12:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567820; cv=fail; b=YPnt39OX/YllkYXLqqgnY4OZRt/DjJzZIJIOpzelQI7fjz0aAfkRWoKu8bLqH/+F/ybUIeiU+spFRoVCyqAk+/+BVBmRSY3wdQzWYz5Fgy6DA6vZSIZ9xNTrwD2WHQDWJ9TbMgyvPh8/VIxEX7G3miNEBheGJKpLyk9ha92IVi4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567820; c=relaxed/simple; bh=OInO6yAg14U2A4TIttQDy/mS0VvP7xhIZA0f8KUS5dk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=av7vuNgfoNBL2hnhXl9YGCnQJ30WMhaKyPcsftZHXEjWo6ozPGhWb8LcW7XwE+nkS9f0rfFfUXleuEIRMF9uAq7fpr26Lqb6+pC5wvIaGP+X/smQdqvDyoos5gnYxdBWwx9QWcf9V8rfusu5/GKb1sJo27b3yXLI98UZz66E2Hk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=cZipzCbo; arc=fail smtp.client-ip=40.107.13.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="cZipzCbo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlXs0UjSi1vMqrsif1HGZWkYFRbJp5ptGqN01C/w36+72HjBo1F4BRhOwNNTCqOqaLZOpSKXfbliA+qkvsAU5Cgf35G+RwaQjNZYQ1QrkHVD5j59qsfoD7gd7Mra2rwqldL0Vq9DL2BM2QvnmbFfstGBhIzoxbMTxhTnsByiuk1iRa7ECKmwRW0DqiDf51lr81trGRfAsmNs6E4nscBqNCXL6i5N6SG4zQFlillgcg6oK+GIeb3H0eU6mlI9NQWpK5s5KDkt68OtZu+VYcizlAm+w2MGm2L87+jGm7fLQvQTzvutC+qd/JTm9bD8aYX6kPykkTRrv6jAir4+re4jbw== 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=Wqps2H6ek/2E0xaTShqwFIZh5vfJN68YleAmPS73MD5W5SoVgwbAL4AsdVMD2Ydkp28DMxmuAyw5NMfP4rQSPjc2FGYnPpqH0300OrqSSOK8fpBYm09nBz0lHKj62F9ybqmYEhRx/7X0Hx5FM8I4lHVxeLYYfwXqVFoBOyc+QQOPdPjrELs1VlYD73iNLmfz1p9sdplARflJDGdreaDzKXj0/FBB5CaQWHdMw3B4raDm+5l1bu944XsKsoKkNti5vDonGJEcwcSr3LE6556bb6BoDbKrMe50aLUGzkBAL/OeyN/C2sfng1s7xJCIki8XRjPQp2lQvjWZOifuP06v0w== 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=cZipzCbowOFGsvyjBkun+Dm2DvrXj2nY829GzsOFOCWmjkxfTSDguNJLA3v/mcRAtzS9zlyPndCuiBgZWr+/h4CxGKbc3c2mh8+jqpbYW0tGdG6Bjj6iD241ieLU7hjzwlI4otXahO180IDEK8Qkn3NZ3I1R90+PNLttkA6IdwE= 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:50:15 +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:50:15 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:05 +0800 Subject: [PATCH 07/21] pinctrl: spear: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-7-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=1599; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=gLxq6qceZG7Nsihhv4/AWrdppvVafau2eKIInT5INMM=; b=5hrt0gbxJJ7QqY7zWkD59XD6gGmBtnJ2Mk2mppbXKINjScokK/bEUlyDvxyY37V73GUwBmelp 8QpZLElFZ8OB/OjNAS53Kw/ZvCNuX3C/romIDSd8neQC4zDRgxkW5fM X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e665480-5eb4-4375-39ec-08dc69dd3f8a 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?BSNAqcpD021rTm4/PGaEaMa7buoVUhk?= =?utf-8?q?6+sw+v8CdPbqnD7yq84d557KwnnMXuxiWEoNL6hvErOKXe/sVkSwId+qCuq7OyWF0?= =?utf-8?q?blYLxx/X1aciZJjZ9FO8tl9oEC5AIrcT6seaxhGfpiD7zNBcKlUcKd7ZJYhsY21Up?= =?utf-8?q?IcPe+JlDjTgit8mUWM6c7MzdQqbRsH/fupZhX/+p+pHbmnACYObTsVilFJFwQCp83?= =?utf-8?q?cL151uLDVmLCDu3iPh3ebU1+nthKnFbLHvkKw6EmcVJ+bqlMs2yFzXTpJuAhJxaUv?= =?utf-8?q?g2V4ng+bk5HajHWPuBPGyuMwEAAMRmOoerVOHshU/A4okiVDp60GWW3yXRWpmK5IH?= =?utf-8?q?hxgPwnxkdRvnYyfy0DmxyI4yKsSQB489mv+o6S8S/5ZLx6auZrPptl47rm5Pn4pXV?= =?utf-8?q?+jAcvQoZKy6S/SxMpFdhkX8kBIq444zXAaSZLzJskvHKN0Bn6epQnNJ6ZMLt8+gxy?= =?utf-8?q?4FIzTzS+6CenRB5R0/wSBzYknoqBlyzlsetyR7qCrmq5aiJoFjl9EmbWb4WLEQdfG?= =?utf-8?q?007X1xVBoGiweOq34aZAZt426ngPNJ99TYLu78mLUZVyhDL1MbZ1e9qSaKNY/2nXT?= =?utf-8?q?eeGDzizyQoj07H3zGoFdOAkfeGhePAYxCU5t7NNHCoPMzOt3iOFS7ZZUGddY0hxRt?= =?utf-8?q?MjUIvxSTQ93sQ9mszsgkysmaqX9dCJIkBU/I9BtC1wZU0HwSM5ldod4QDD0J5YdLk?= =?utf-8?q?nfAhb+6Qi4FwrmNUNMW5f6w1xVjP4gHtFNPi7BpsVQPNz8C8i+1RHMysmjthFN3OM?= =?utf-8?q?OmBnY9E5FgnXD99P60ITlzDaQBcnVpKEQXVAVzllsfAoyj1YlBUpLhe09bffIU/eo?= =?utf-8?q?e5gSIOndbanAyx79petcca4hjY3E+rY4Y0y5nHq/bbCLRRmllAuIeX71qsi8eRBg9?= =?utf-8?q?pviCqNsvu8s/BtgWYTNauFjevRw/WthoSAO56cHgSC8iVUHwyAPOvfwHJW5fctbti?= =?utf-8?q?zMR68NJisku3ey14P+XZwjAfJci7eX6UVw6n+3fNNhjB2KoAxxt9jW5I4QXUB1NkU?= =?utf-8?q?lXn9XZqvehF72g/jrIFGRJbHoHVDd0ttoacqDZn+WPpVmeGug1E//iy0AVT6XKAJL?= =?utf-8?q?9Mb6fVZ7NVnC6IxhpYzf6Xxs2N+3MMrzvIXpPJsgHhvnk0hIJaZI2zy9ETaALiWPc?= =?utf-8?q?z5Y2zDr8PQmTWU7oxoSC6LlvNwrzjS/8Kwh03mZ0PCUJYbJtc+2+pZsBnMiSoDi0Z?= =?utf-8?q?rTkGrAJMaH2od7BoZBhuwlGsoR1V2RjOwlCub/2AaowtCwkfXw4UWhcgLZyJbg4QI?= =?utf-8?q?RqLYFgSkr8WmHI+GeTxwTWF9BAO6Po5NhzSvLXEmBrfBzrm9SfRpzSHA=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?ipRs9/gpI3sBhxOLHJeN6WIezjBv?= =?utf-8?q?VqL2VpR+hDoWjylUgkVH1DC+EhT2xoB+Z83Kr7/KARkoChBfyGqVyIuEh1lk5mzOY?= =?utf-8?q?0fsx/7vTYQ2bWj/XevCRPeY1j9Ao/Q/tZQA6600HcMFwpwEjfi3zyp7us9q91fIN3?= =?utf-8?q?GzerPqTyFq1K2ZcZFIs2m5+vDhwcGEMawTMG1GgiQ1Pou79DGWV7C02at2bz/W/bW?= =?utf-8?q?dM46JJLITkc7OPrH+nV6xPG/Ai3s6YlZN7N0svcaxefgAkJvEjWA96toHsQGruybC?= =?utf-8?q?Z+lqO9AYE3BamJ1XrAjk5wb8aqrNXBxdIbANWMHg6WQFIGhBfhR1usgJOqVIVYOtY?= =?utf-8?q?JEHbHBPZePSTTBMtFk9nU/O2fvs82AzHA+j8daf/iVrAOjwvFnkFfgWalowMeOM+t?= =?utf-8?q?/9zx1xMa6tkVTWXv23BPhpNolo5sR8Q6veXhrr8+eOyZvbqRcEy6QRFVPwjnMJi1Z?= =?utf-8?q?2SKqxJjz0NLBXxGS7QAzt9NWRAnfXn1WimBKt6sbBEui7AZrAuCENZVM2QZgUCCPy?= =?utf-8?q?fBZo71QC/uaHOZXMBdLEvE/yO/9RV3CPIlUVVSxuQjJ4mPWJyQaNqqxJZIaciMuYL?= =?utf-8?q?pubu6TydMXSqKnN0VPSKiOEU0JqX8Sy7hxDdI1nYz3SGr2pZP+/gZ+Z15CIKPo0as?= =?utf-8?q?8yiINwkGyPvYSBnCxHsWwZMEtHvoFqdKSlW6rT8bFqB5Ed1bfdD/UWjPgrBMtCCbe?= =?utf-8?q?pe/YACbPlBA2BABDM8terC1T1z0J8QAEILZl7ZExFYBadKcJrSkAkXoDhA67W+enZ?= =?utf-8?q?slZtNErhyQe+JIT/ZbjodCmwf918UXG5Grqn20qbCIsw6SywLSk6OPJ8ozh4dXbbZ?= =?utf-8?q?khjwRoYxu6euBF4wsLeQc3alDc2ZfXx39s7A4XRGgFE9GFy6g0vLz8B98MJLPiI3h?= =?utf-8?q?vjh56PdH4R/azZrBK2Ukgeykziw8adBg2QsNuf4suLDE3XbWTIabqu5/Upc2xkzJp?= =?utf-8?q?tl1KmIJpVQ1UOXCagfXZIZYVQXhr51yxmRzgN0SB01Js08mBAzn0C4mraD9yybax7?= =?utf-8?q?dNxxlTYamLTRSqGOGjoKWt2sSK/owSVfWHMN683d0T46OA8Xqt+/xHmiFZu66m8OF?= =?utf-8?q?HDKAVqC5CLwbDYaq8i2smqfYAaoPJlG//HxTeYt5pMHhsJ+794QxA6SfJM/z/7Fz4?= =?utf-8?q?2/07hsmFfwlVZLDrUdRfgiWJkH6zH8Kn5AkJJsGVJ0T8zcRBlU7Tyhw/JrGxx3X7L?= =?utf-8?q?Oqxa/gHONyVXfbJLZsrep2fZ7qxunXQR40TadIGuX7sn2KuZ84O8Q+iGVdj/D9Rla?= =?utf-8?q?z2+U2vLG0n0p2srKMc7x8CQi4OYe0MPx5aFpuU3Ta2FvhUXdh5JzwXj9SYk92FfG3?= =?utf-8?q?H0nxCG6sqER8jVLAAZyZg5+SIaOO/Vd28NSTiYUTqoiPLxdGwGAooIXx5lvgrSzAd?= =?utf-8?q?NPhk+mBM2krx9YpCALXw8EmP/3rBxXSyFch7pwuyMAG05UPpTLz3ndol7l9HrMm1Z?= =?utf-8?q?2vvRqvDBthTe5kltjSQ9Ro3cXbJhNpjWXuas5euTnZxgqiTIpw4VVWDDTs7drznjx?= =?utf-8?q?RKvCb1Hj8ylC?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e665480-5eb4-4375-39ec-08dc69dd3f8a 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:50:15.5502 (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: XkHfKCLsyqDxegbPuqxBxgVbu73I8PVYwC7CDQNooBActqbhc11Njlm8wnVrI5roh5OyAWqtvP41o5HfZmQ6aA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/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 Wed May 1 12:56: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: 794580 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2078.outbound.protection.outlook.com [40.107.13.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D93585659; Wed, 1 May 2024 12:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567837; cv=fail; b=AgbFTqzkovjF94PYAaUSfPvbnel/N/RCbKIrS91ibepw0mI7YKz3h8xUPr9bPI/osbtRgEK2j5BPD8HQTV4kjes+Pco4XRavEFD/46WZn3ezZ8T3llvybfipFWykUtsE2tu5Xe6QeCv/kjrbt2+gF5yQP3Mtv4JKxesCkwAB6tI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567837; c=relaxed/simple; bh=iX5zubnNbP8wUY0NaYvwWM25wwxei0v9ssdTCrvhdpE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=snlyFYhycTL6Ao9GTjIiy62YCIIFKyN/vJ/0cwexc/3C5fM1NB9g5jaumR/2H5C7SOkvCpo1fXyaZf0DGWe8gUDxhDufeIfPD2EkrNFPnSRCamHKjglb3pD0EZYAlnA0bWge7NDVbxKhzMEHatMvDaQ6gSkYu1AEk0jD6/oVBn0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=Zm+NsPPc; arc=fail smtp.client-ip=40.107.13.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Zm+NsPPc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h1R/2kBSygpawbf/OUdQzHQ8cQ643vlrYxy6pXl1/l1ON4OJzlLvioqsfrMReStt9XDLrf4ryILDcawhr27WTx8bebUSzgEdGUALzgDeCDRBbF+wTD0wZjPBTTFvtQ7q0S/rajXTrIXzton4inJuxl61cVlyLg8/lBxrjD+e4LnPvPh2j2XnRdXmZxF1/v2d1qhXCUqvMMIh7VZ5YmbK6wUvi4ANQoRCpn7PtPKvCwbHIJZFIYyAAlyv3lvRhMkTfgDE/jSdDGgUU0G7YtJqDwbjjslA23Zdio8axpWizDTlRLKZbeweoqlLRNhRjC+JHQSS8UtDz3bPjgvfbs8nbQ== 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=0Y2gws/G4cgntx6EEddCXLTNXN/B4Rx9dThNutE6diQ=; b=iq0gi+X5N7Mi7NnfaHH1V9/sFOuQ2U9Ww0xT1nDaMNHqXbYUQtHIvHHJY+jij4BkkT7b7WDCxVbPeGVP9DZ6qWTSCFGXOw5gi0Z2N9pPUvIeTGDNbJmLxfCxlt//n+Lx3BdsQY3ID907DrZaKL7TNKQbZ+UZgpCDqE25EZ6Mh8RejuzS6UvzlhGj46ymvBsRz0o97Lc9NVlCsZlQNkCuP7ogu1ZqHEai9YZC2KGfkw9VEZQbSyt8yNPsEXHlv1xs2NJOZ6m5W5p1jgSjMXf+Sou5sy+6vCIRuUFbQgVHvTXl+1NiczKbIbo6/tzgGkDeARcdLzsSdjnD6gkGe1n9xg== 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=0Y2gws/G4cgntx6EEddCXLTNXN/B4Rx9dThNutE6diQ=; b=Zm+NsPPcsYoi6mAXOX6uaMJwH+ovuA2QxuaOUEq/1u7KpzczHyQAfDM6BCMhDSdv8WNr8CQGv1PQIF0GBJ4Efcvp4ja/+p5G3wCpP4/vJxb3AO47VyE39qn1x7WNLTdy71eh7daN/nEnag8UFvmfnk7MNUiocdWO1nzb8sEJ8p0= 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:50:31 +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:50:31 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:06 +0800 Subject: [PATCH 08/21] pinctrl: samsung: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-8-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=7744; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=VeeKDmVQFVd8U6dtzX+Yajlue65C4XZpXk6FDSk2jZ8=; b=GjOh3r0Wz3VqGH8e47xY8Tl+zHfs0c4a7emejd8aav46XxJ40wN5UDFD8JIY+5m4vEqAFIcIG Dd8NJ7mUJcTBSSvQGK6pnvQtPNFzalqmOpKN5v2UL0paRoMFo2tsXKl X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: d4d7ff38-bc6d-4b76-f92d-08dc69dd4925 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?rFEcu2BCn5ROGyHAIHlTppB0vTgtaeP?= =?utf-8?q?m+RvYZmifjJVqVedQ20mglKEBXwpTy/Ca4SMFmngPe2RGG/q1DE2ME3R9+j4l9dq8?= =?utf-8?q?Oy9oFXXCovqa89aIfhYKBr1uuS9Hj08CcvY9r1/KRehp8iWkpcZy8XSY7xQwLC6ld?= =?utf-8?q?H2LLjouYFWb2S41ptjbANN7goUQ4imbXo3AnTXWxfIPF3hPyjnYKo/vroGVdX1H1n?= =?utf-8?q?xB+ZEEMsdd6s2UOspqYDr9PFnjHR9n1+d7ejoodKW9/Xci7cX+uuoTwvj7K9th2kR?= =?utf-8?q?sneL+hbJ122fCxvFTJ0sfqTVDgAeXZJbPXElCHGnB8loUazDkjeCTnSDGVrlnrUuC?= =?utf-8?q?voetUdHCzuomFQo6HEofklwqhTG5QTe3KAxB8kru1gZ8VKD2B8MLFcSDeXeX3YyQf?= =?utf-8?q?CT0wvk1n5Sz01TtbfRkFcQqgnotl7PytZ5N4Lxb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7NDsseR1hsaCcE=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?MzyuEzmVzKp1C8EoC4I9KVwMfqzO?= =?utf-8?q?OJzuWMyynwMyTkB0qXG1T2b7Nk1wEVwH9Lw8mPPeCh6HEOe2mpvFOCZF+UJaPE+uY?= =?utf-8?q?yrZhOBucdjYNpCdje3LLCIJZ2krTo38ygtCd1zw3BEhKaeOb/WIUI1Yh9zZdpfUTY?= =?utf-8?q?JfFobRotqIy3TAWsulh7KeOTtoOtBQEOUvBLNWTxLsSYszqkaDG6ddNZod2vjWXVD?= =?utf-8?q?WK02LdsLH2/dYDWxH4q9TTp7i3qF0MbYOZpIFd7iPH/LeN62vBF/Hu1c1WlTsgJ+z?= =?utf-8?q?b2t/7rja1GzVsKYkYxCSWSzemJxxDBsnFrf6sHHtuZMldx0pUD7FpWFuofHUY2t6Z?= =?utf-8?q?9XKDg6XmxCMNIT+ncOepKGzJ2B9iO+V9a4/d8oK9onYmWztRedpA7GhkTVcpHKZUy?= =?utf-8?q?mEjs96BdNg5He6wwCAlYFu+EEYh+SCzgUwHrN+xv+3iCSdBEDanszNPqQqfT5tq8v?= =?utf-8?q?hdZYkdIGOHBD8lIGdourHExa7mi9iUrOiQEcTCv7serRFSLPqlulH2Y+KACzCntcq?= =?utf-8?q?qqjFWXVXhxFVgAusNBQVF4F5f5jnj05U0D+SANjYgOyiSsyPEmWtwOq/kyiCcQ+zr?= =?utf-8?q?S2rMxmETQLCKZsqDAQoXftWGs0wM4pYYjH6SXqewdnslmyQJUEpb2T4rDXOLMj9qv?= =?utf-8?q?a2mBA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r/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4d7ff38-bc6d-4b76-f92d-08dc69dd4925 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:50:31.6833 (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: XVJQm0zO6JyJOjmLH8XQzYxhYJZMbhm8xg/Gc9TT1Jygkr7A547REQ46IEaW+RGW8MU9K7FRr7slrJKBXFh+Pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/samsung/pinctrl-exynos-arm.c | 3 +-- drivers/pinctrl/samsung/pinctrl-exynos.c | 16 ++++------------ drivers/pinctrl/samsung/pinctrl-s3c64xx.c | 8 ++------ drivers/pinctrl/samsung/pinctrl-samsung.c | 26 +++++++------------------- 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c index 85ddf49a5188..9a57b3ceb536 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c @@ -56,7 +56,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, const struct samsung_retention_data *data) { struct samsung_retention_ctrl *ctrl; - struct device_node *np; + struct device_node *np __free(device_node) = NULL; void __iomem *clk_base; ctrl = devm_kzalloc(drvdata->dev, sizeof(*ctrl), GFP_KERNEL); @@ -71,7 +71,6 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, } clk_base = of_iomap(np, 0); - of_node_put(np); if (!clk_base) { pr_err("%s: failed to map clock registers\n", __func__); return ERR_PTR(-EINVAL); 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-s3c64xx.c b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c index c5d92db4fdb1..9acf65eb0f5b 100644 --- a/drivers/pinctrl/samsung/pinctrl-s3c64xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c64xx.c @@ -685,7 +685,7 @@ static const struct of_device_id s3c64xx_eint0_irq_ids[] = { static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) { struct device *dev = d->dev; - struct device_node *eint0_np = NULL; + struct device_node *eint0_np __free(device_node) = NULL; struct device_node *np; struct samsung_pin_bank *bank; struct s3c64xx_eint0_data *data; @@ -701,10 +701,8 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) return -ENODEV; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); - if (!data) { - of_node_put(eint0_np); + if (!data) return -ENOMEM; - } data->drvdata = d; for (i = 0; i < NUM_EINT0_IRQ; ++i) { @@ -713,7 +711,6 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) irq = irq_of_parse_and_map(eint0_np, i); if (!irq) { dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); - of_node_put(eint0_np); return -ENXIO; } @@ -721,7 +718,6 @@ static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) s3c64xx_eint0_handlers[i], data); } - of_node_put(eint0_np); bank = d->pin_banks; for (i = 0; i < d->nr_banks; ++i, ++bank) { diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index ed07e23e0912..4cae112ca15b 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; } } @@ -753,7 +751,6 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( { struct samsung_pmx_func *functions, *func; struct device_node *dev_np = dev->of_node; - struct device_node *cfg_np; unsigned int func_cnt = 0; int ret; @@ -761,9 +758,7 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( * Iterate over all the child nodes of the pin controller node * and create pin groups and pin function lists. */ - 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)) { if (!of_find_property(cfg_np, "samsung,pin-function", NULL)) @@ -772,7 +767,7 @@ 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) { if (!of_find_property(func_np, "samsung,pin-function", NULL)) continue; @@ -791,16 +786,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 +799,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; From patchwork Wed May 1 12:56: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: 794037 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2054.outbound.protection.outlook.com [40.107.13.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 369F3433D4; Wed, 1 May 2024 12:50:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567853; cv=fail; b=gxTFg3ZVh6jWnveY7mGDoFvfxop5CBBsUi4I0h8MRBeWKE7veAiIkXBLtUKvOqnk5D9po3tglnElJo9OMjqEO75vm0uQgFuiMYOXxt3vihUxBbCrx2LWOfDnTWi+xP+fxrAlwyvaf1GpOrO2m9y2rFiaZbvLqq39/QVhY93lfz0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567853; c=relaxed/simple; bh=S+XkLCHnGs5USz44JLyd+Xp/AaQfbVg/qJuXb2fjjLI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Oh4JufpFCEKfEFE72uWbXltSzdXkOotfxRE5bZ9XiPFjL8h45tVOfXnX0d5PRtDLJ7ylf79jKduuhUBrkOpAQxJOkNLoCqnxeYulMZRCzXxObskCpQOTeSDP6yx744adGx4L8FdW84/E6H6oABCIn9eVOX6spLNaoqlJKl1aHzM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=T4AuxXJz; arc=fail smtp.client-ip=40.107.13.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="T4AuxXJz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kTfCKx4cSQWZztbmuoS3CDkZmsJd6pJkp9KUN42/IRrqekpRuEXUNjnuQNtUp2A5TtNrvsAEBC7F9wLwEnlo4V1c+iATn53OlCqDXyac6NiL0+OZo+2OCpH4QG6KuGEJF/tW3GO4hw6ZbBiQQ7YALdztrJRXxlPkzKtzObPrfvFVe9cBTrXtOREZPYYvT+Y/iZQqKpD7cmWWbXmP4hmDX6p1MEjj7QfOuNylW65FZlIPW8LqaSf/4NBOoLjEqXF6BpxRBpKci3N5nAkFJQ6v99pHPyDAWs+gXAHaP0FpbJQ5K2HE+wvPNDPdw1/4KwykdX7FMgaUmd2PCSzVJfJoWQ== 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=UwLf//ulDgKGYdIslgc2mcconcEqLiM/aJbLmOr9R5c=; b=Wp35yQ9T0zgqXbj+1O2zlHGwK4gljsITTMatgAA2xUBsbtz+mrnjjEYSNNss2Xg5zqhNGwgNSzvO98hqNBS2fsBinW7iwij0QJSTasQLhUQ8rfdyE9bXDQYHrXbIve5Gk/CVJjIn8asNGXDK44/ZALhOdvH58x/k4HDlIU27/DiPMS/z1jx9+I2wQg1ukMRDhxKQTKrElgeXSKC00oa4QT5iB8YBI4Kye3m7ndqcp5tk0muDdcQzK1kyPs/rti+zsDy+OF6I5iIYLvjLH2+gydkgeoGaVkVz7L7iXyAFzc3n/7Z2lSei8L6UQvs4xXji/IbxWrVNFEEat9a9qU+V4Q== 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=UwLf//ulDgKGYdIslgc2mcconcEqLiM/aJbLmOr9R5c=; b=T4AuxXJzaFZv9OPj5JPUvQkK1dBLoFzSWv5wa78VfgVX7bUbOvxHJbvKWG0QKFPl7cF/h8jw4R282M03y8T+kVe4YKc1kJHwYJwpzwTd/yVkyQabrBfZrSYCrJmpMMk6m7u8RxXsDTibdxM8wus818FvydAO0l1G57bIb8YA4iQ= 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:50: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.7519.031; Wed, 1 May 2024 12:50:47 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:07 +0800 Subject: [PATCH 09/21] pinctrl: renesas: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-9-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=7968; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=K64zqrCbOC3rYAPmpNXeqloBPZKzMWC8Ln5phskDCDI=; b=SVSZB2OptEjixUVsBxQFlBLMyaX5ozL4HG2RhrVwKgQLHU+s64uygotTA6azDA6z8npJ4Ulj2 IlTLsI741+qBoolYUGSxm6k4Tb0gI94BPqScicGbaZ2GKveAWUAEHGf X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 7332603a-25bf-4c13-196f-08dc69dd52b7 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?kbL/jGMQ5emKVei49fruJKYt9PKq/9c?= =?utf-8?q?R+hE/TxAwl/ShC5r/5oiasr9ptqMLr/adSIxA7nUpAkTcViSq2V0FyiiAZfYQNndE?= =?utf-8?q?WaVFORU6/OrKrMCeJjsLEgxuy8My3NCx7lZpq1NO+pwIqyvk5lrwMWlPiL7Na4Zyp?= =?utf-8?q?ZIrCS8Nazzxnz0pV9D30f3TXbNi5nk//pD0w+WVYl3CSJC4/shfoDFn9nt+4akX6Q?= =?utf-8?q?smQMG8fBZzL8bqc50HvyIY+u+1MdwKhqcCfU7Mjt2NfX4ibY+EJxXUHmnefrn2YaE?= =?utf-8?q?aYoskmfiRdPjdMOxSJv+Exyn2gfDcC/OBAutX9Q54UdJjPwcnZw6OlnDxtTvR4Yau?= =?utf-8?q?qllSD51sGuyfhKlLXvl3IoTSdykcKEyWkGfZzbZTT8C5De9YIf5xPRvLeeJOzws03?= =?utf-8?q?hL+5h9iMej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stSGHV448X+2zE3JH3vvEEfPrz2YA=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?95jtY4aHlWwF+WAUE9SFYFt+OpL0?= =?utf-8?q?RW12qkPIyxNdw+mWfY7RPuB98OxW6Ikc1SdsKfwEvtmBzM+JoGVCVctfpLwhg8pa7?= =?utf-8?q?VOFjcXleoromEXRY0ey61Qy80gqVyhlbxAVpgeoWqoKXO0KmTKNdIlR5LkcOnDT8R?= =?utf-8?q?+SJ1SM+934gNOjfS7ooHhw/4w99K2l1NxSKOl/TNJqt1gbxIus8RAgSPe0wDakEh/?= =?utf-8?q?koWBSvfu4qeCqr3DaZKo5gD4XhHlqX9fxbCfjrqo/sA3mE4ngaz80XDLI83e51sy2?= =?utf-8?q?+NAMm5kpq2ru0DCsoQeg/xRzOJyiOIHN0hHZlzT4BjOHaMiIZ9G7SkVNaWuNCvm9B?= =?utf-8?q?8JsaU7tm4ysyR9YIksAbofl8j3vcHKA5pfP6AVgfQT1ZKPb1SijW2tHyqRBNQR4ro?= =?utf-8?q?emaI97QVMpkpHO1rIIKMx1QXTXG0VQuQ0ToFuvOL3hJo4r418j3D+qUdgf7xKqwRX?= =?utf-8?q?Azi7X8KZf+5k03r4DNXo8tULT3fOdSsB/GqqBuZP82ZLY7pdiUUUr7yobJv8Qj1pc?= =?utf-8?q?VLir2GJbk4nAcfMbSY24yrz71kAYq1ZmTbsI4yzoaES5FnqdNh4BdJIsbcX5lqcYe?= =?utf-8?q?HQItS5y3BNv17phs4NR85ht7SMHbniU9eUGgLRnDZQzJ8touVx0WiBPWjdEUfoi+W?= =?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utf-8?q?p7z9lZUvCznw?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7332603a-25bf-4c13-196f-08dc69dd52b7 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:50:47.7704 (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: jgoF+yszrnD5AaOJsghO43g3qH8yKF0h0gMRpzeHEQQMg+zIOBVBqRnq7ye3+fpjloNfUHkXq1ug+XUNsY376w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/renesas/pinctrl-rza1.c | 14 ++++---------- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 10 +++------- drivers/pinctrl/renesas/pinctrl-rzn1.c | 23 +++++++---------------- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 7 ++----- drivers/pinctrl/renesas/pinctrl.c | 7 ++----- 5 files changed, 18 insertions(+), 43 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..85a4f3c7d73c 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) { @@ -2201,7 +2198,7 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl) const char *name = dev_name(pctrl->dev); struct irq_domain *parent_domain; struct of_phandle_args of_args; - struct device_node *parent_np; + struct device_node *parent_np __free(device_node) = of_irq_find_parent(np); struct gpio_irq_chip *girq; int ret; @@ -2210,7 +2207,6 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl) return -ENXIO; parent_domain = irq_find_host(parent_np); - of_node_put(parent_np); if (!parent_domain) return -EPROBE_DEFER; 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 Wed May 1 12:56: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: 794579 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2040.outbound.protection.outlook.com [40.107.13.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A47385951; Wed, 1 May 2024 12:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567869; cv=fail; b=ucHSac8MxWNpyfjpsVaELV1a+LNSomsYOn+66Sv8aNtY876rCIXCAQP6eWsOUcyEAAfgQfdL+/jpli5spjfRnWiRBroVAIRO2mr5I510HfRqt2Xu2Li/VmQ21oI7g0/1Iiix5gEcoj5DH8UK+9TeCP3mBCW7ofUObkeXDtLuGWI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567869; c=relaxed/simple; bh=ev+2uaDt95F2ah62MY+0N0rG8w7C/Honrt3IgR4ajBs=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=SherZHNEcsIZ23oKBURenZjp8sQMMTnzOpQys92tNob+GA6Xkas/MtGy8Im4U/lNGUx2A+ShsjjnU0+xFz7R/dp2RK9Ei3tbKG8DXXGARGC0D3OEUPO1/Pt8/0Ar32M15VnS0L9Vw7UFumX3KcN263KEFOBCFx+Cof4EtoC+ijc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=J2Oo6RqI; arc=fail smtp.client-ip=40.107.13.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="J2Oo6RqI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mx2AIyIGzfd5Q77t/6LKVx/pkHtkuA2Yj0BCsuwrQVDHwErQBzHCXeXnqjYohlr3QMElIR6WaLBzrn6wDFgMN2/o7kyNeGkBirwKGPTKRbGx4qDcbY/qWfjZ/HgLidONo7R2mF02FD2MW2+WlFwbUMdWSBTMAJb+BcW4HEbaF6JhNyTqqBoE9ACTKBlCXjNENbd2z55sc+LWPiMQnZcXJnd8dRRVRT9q4mVEsYJcDZYCzuwA++YRz5ESw4KUJ2yctoeDpSykjgtwf5Xf2E2H4vaFYpF6ygESZO2/Ex6elMMwkmB0IjKr78b9FALhVuF9S7mmwyAaqjZdKIaCfc17Pg== 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=sKdrrsLcFbXA49UIlhYel38tScIuaU0cV37+EwKMmJc=; b=jWJIiTtQ2JWx1tXUI3O/a+3V4flt/DVMAVhRT9e/oUUR3d8sLCGsR49oPGzLJEcaPE2XgAqq0wQk5foByxskM0c1vBtfr2LSDG4zpTtRvRylt9ZeHpFsgoptWwW0sTPX/KPIfRieHn2qNTAjIuJL1kGrq3OQQTTjIWnXtdt8N//1aqtXiCFBTgaUDsZI0fueepUQFlLNQyQnKfwuHZapZE6f4+KcLpUXUQiUUKwGcqNJmmz7RlxinXZeYGObXK9uriPebFBJhqwVn1HdzGRQgIE6mnlZbz+U952vQX5Nkxj6xtYe2UmQDeiHoEbJUyE54wCsZ25Ug7rWmSFSuMpQ6Q== 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=sKdrrsLcFbXA49UIlhYel38tScIuaU0cV37+EwKMmJc=; b=J2Oo6RqI3waIqz8/6pJE5VIjvbMXZSe5gUN6zo25Gx2wRaUYN3JXtAC7WssgiIVDpRHrMpNXfPVN/IOqJkvmJI0vAVG7VqGK1VpTktBlB9Z+s3qmpAcohAoUsisgnz/QGmQAAxIrC7PvIy9KaMJvF6Z72sok1m3zgN1+94QRUjU= 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:03 +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:03 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:08 +0800 Subject: [PATCH 10/21] pinctrl: st: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-10-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=4898; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=VzwfunaS6oe6w00xXDeMo+Rdw8rpK6f5f57ZNP6p+Dc=; b=YiGY2Rbt/DyQTdPhzE0bccyp3SEualuIWcMVbzLs6lRVW3PSd10C6Ggee5a8mAP3Fy9euQt33 dt4PDc3LBg3BrTeQEfKFaGCAetnU0PJZf9U8UlJdlsGdqeAQHUFcjkh X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 14565aa8-5af1-4eda-0f3b-08dc69dd5c53 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?mNzP/IPVwmMsCAwETAl5wsOwgykWjjP?= =?utf-8?q?c+jVI7Tg071dU3f24pzQ1X4RbfnQrxzSHXjvXcfUdatCDy78Q0MiMJwSH3PTL6H3+?= =?utf-8?q?EUAMjLLLnWbKverdmEHU9UJZmoVeECnNb/bPJv/HuXOJmDxF5Bie1/NFGyb4Y9t0+?= =?utf-8?q?GCc5dUvIT6P7Cu8zlAK5F7SuEU0PnZRRUY3G3ETom2DFBxCzxVCOOqb1VkAfLYYoj?= =?utf-8?q?xH4XP4bqXA1/9U6KKMCSJjz5hZteMDcOjKldtBAprUlQzmHe7R5vmd8j2a6rX/EVH?= =?utf-8?q?EWEpK9vzaKseIr89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kF/0eL61p3qs7SCDV+WIzkM60yGyOcAwG3?= =?utf-8?q?8xZeeGTUj7yMIyjfBhR1xSQ0AuzEgG1YELiuGxckg/eIvOgrqQ09V2JmgxK+mB1ab?= =?utf-8?q?/xGdvbsr+GHiiBEjT6UFp5i67KJAnTJbFGNEOaKDpzC9uzZnDDDKVjOk=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?eR/XMZXiU5kpiRxCJW8xGK++Vx0b?= =?utf-8?q?OeEEtivU7T7numAm+FVoM93lYbr5pIZ3MLvUkyssiLwWZIpN3dl1P+TF5pFL5JjEI?= =?utf-8?q?zIUpOZwskP+wuLkn7HZdN0pXrCA4R7V4kCagPzulWj22jB5DcYlsZp/5P5jylpUjd?= =?utf-8?q?ikaMTnlVdL0yI7fbxnge37i04NFObfqSDyuumFxUQRNAVkOUrhGE17f77B95vYzHY?= =?utf-8?q?lx0vq7JPmlOOjsw7rp2cRWjad2A7204yLoAc5KBGsK3lxh7AJLfq3mxqyETAbaCNU?= =?utf-8?q?Ae5h3ovwANHwbM65DCRgdJQEt4dePce2STApCOE9GXwFSFZcF9nJEiTyIuX4lXX6H?= =?utf-8?q?qUJ8q4efwMijK8cl6gUkCRdLlPvQKa/VTB55yX/Ku+63U58uyCpbucqp5zuHelC6h?= =?utf-8?q?wkwojLJdf/VhTwvPBf3TFJdnEYrZUpnOkit5z3xQb5FK6TsK4BPvnUv3M5Qz5C5kx?= =?utf-8?q?gasQ1OezgJvSvJ9a1sqrPqj1wYqp2OhoCqpPPJhOkS4CxISAxnSHNmgGE8/4ccXJZ?= =?utf-8?q?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sj8dfzjjhYRbicPltkmneiJ+NBSDTrhMvoqhtaG3XigTLLcQaFBIgPZ96?= =?utf-8?q?m0GCqY7yWHmdfYjHVDZQSZuRhuxwlzTbBwBXj32XO3T75SMxwk7BcV3FtoK5eTfi3?= =?utf-8?q?+DDa0l+d/V2g?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14565aa8-5af1-4eda-0f3b-08dc69dd5c53 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:03.8718 (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: nw4pC/jn3hWGaBhQpXBQx9748jz/R/WAXvIar8/EH1DUCFNqD6AUSWNmbXQlCObeEqGpzymgQdNsgseCwyj+Ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-st.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 5d9abd6547d0..2d77160f3654 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -812,7 +812,7 @@ static int st_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, const struct st_pctl_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, i; grp = st_pctl_find_group_by_name(info, np->name); @@ -837,7 +837,6 @@ static int st_pctl_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 per pin */ new_map++; @@ -1161,7 +1160,7 @@ static void st_parse_syscfgs(struct st_pinctrl *info, int bank, static int st_pctl_dt_calculate_pin(struct st_pinctrl *info, phandle bank, unsigned int offset) { - struct device_node *np; + struct device_node *np __free(device_node) = NULL; struct gpio_chip *chip; int retval = -EINVAL; int i; @@ -1179,7 +1178,6 @@ static int st_pctl_dt_calculate_pin(struct st_pinctrl *info, } } - of_node_put(np); return retval; } @@ -1195,10 +1193,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 +1211,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; } } @@ -1224,8 +1221,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np, 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; + return -ENOMEM; } /* */ @@ -1260,17 +1256,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 +1277,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 +1591,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 +1635,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 +1663,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 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: 794036 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2050.outbound.protection.outlook.com [40.107.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22F3286130; Wed, 1 May 2024 12:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567884; cv=fail; b=Fuo4cb5qeqeE1OHHu4V68xSKkuf8rPKEtIa3SbI4G/xsaJpe67APUGbsQlndumC8j86ztynpxGQUr8DQcYb9hZXDEA1x5Jac3JkMKvKJi5DC2b3MLtzgKuOWMzN7R/00ZOsw1SgnQLXLEU65Zv2ZoVV1cxQx51TsLBKd0NHDe/M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567884; c=relaxed/simple; bh=sxadJ9Jx/Jbpg1I1XOHOXDtWzle1Y4bjmwEu0knRlXo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=ESRTCQ3qyMDraMQ86hu1ImhNfF6U2h3hj5oaxJnjqoal0KeJnu/P1PZqxuTlM9NG5z8J4+FL7gYplAVQLoGJ70dCxlPJYp4BxpaZczfcPjP9cFCGtHAVQCI/hbkhDMrUocgOgK1HBrUAuCH9M+Hlg9qDWWw1o+Th4K/sAGKizxA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=dj2Y1hA5; arc=fail smtp.client-ip=40.107.13.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="dj2Y1hA5" 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) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 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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lmcQKWkyajeiRE4uazpr8KJr9UtvPcoe98zMU5w901qrx6mElO?= =?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 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; } } From patchwork Wed May 1 12:56: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: 794578 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2041.outbound.protection.outlook.com [40.107.8.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71343128375; Wed, 1 May 2024 12:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567901; cv=fail; b=YINtHBGsBZM0HRGzj1IrXJtqWp00k0XbRklmpr7FRA3rjYmLwW/igU39bTC/6WQo38m0yXf0NajKyxW03y8pS3X3PwVy/mVVFt1Mva+ACbniXI/o6tpmeYgqDMt6w/6QBhThel/CgwD9M7cphEvGlo1UVgIrK9U3HC2v9Bxti9w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567901; c=relaxed/simple; bh=FyFseGQJmsq1rScaeKVJgP424XsxB+ntR+56HIl8ufU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OB4bNexzD/yjl192WtdBd7eIGtUqoZshCNSy9gF8NJh7UT5x95vTYGfXsli467Q5pJl5EQDLdFr25t1HJKb3x9w5Eqd1lRiUsgd2Wl9Y2xzoOb6h5Q8hz0sUl3wJlFncBl9dPPPGliZgkO0PhREk7R1iC4B0MInO8G9eKiOiUUE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=J0l5AzVh; arc=fail smtp.client-ip=40.107.8.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="J0l5AzVh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cs/uFvgGf7J0mxLLz5tqMXVQpRAbjNRnrtuTQbZ6xFVpU64vWpZmo9HpwTXQCzYWa/HJKKrOe/eZ2LXvaD7BQpwtS35p6j+C3nHQPmpFkavYuPe49nGT/vYZ2PxuzKckhkgcKJnRALoAjs14PBQRXfw+wpWZz1F4HOV4K08oUgwQ/nQccuyhLsOj6sfUNh6EVzaI1MDoF1P6KFSUv/bRlm4BDMunzwy6a4Pql8aH6MubiYkRDyqTECMdJioasGac5S7OO1nGI8smTtubeZWu4hx2Zxo2YASvo6F6WclWhhg3cwrCbVzrRoQGVW9wE67+o8LcZUIVErxfehoC9pUrqg== 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=WSKsscBH/bb9MG7MVyy1EWwJadP4dUF9oRYqYVXqP1NvUQsivx7VTQum9bh5dZ1NPmqaQG5/UfgSqVfRvrJueC8jNckZedJ1B+rZQpUffq1JZhB1WUBok9v8viacjarKybJZiRKExS+Yzt/Vp32cvtPmypPWQLhA5JZxl8GalrEcvOe5hGtHiBMHhKTSVdtEYl+kRVC2e6NYt+lwMHyL/rxSA4PqvweVB6KjTvSpA84uaJJ5P1qPQ2bWuGG5fN23/NzqDDeEnIqz9D15lbHAzBkPSlQt8kduLqW6gOjdKeXK/y3LXF++LsxW8385Xamq3bygfFL8grCzsdU1a1yDTg== 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=J0l5AzVhTQLI1cvCJWqrnkayUw54jIhbmT/JLizp4vhOXVmPOPL2GaBkwanqaOQ4Tt6Tsd1mFCnsi7lXcugBlt5Nz7/1ZDX/ubywgnJK+CL5/gUTdJYp8HKgg2ITuUUTWXWHuSDdhClCPMs4JiahxWDFOva3o+Asr5VsZyprN7g= 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: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.7519.031; Wed, 1 May 2024 12:51:36 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:10 +0800 Subject: [PATCH 12/21] pinctrl: k210: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-12-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=1076; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=58KovdEVBZIsn2lfhZ/T0dqiN9oElq31ckJF6Ac0RQ8=; b=c3FRzwq+30RvCffuhcmIdUhGjJH58EpOfxv532cKlTQz1SNPixnIM2vMx7FK/oFWna1WvxNc8 KHSDWPwcDuiBDzI/9ofA9cO0ZgozcaCukmcjlONWBqylIbTo8zfaTkV X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: d5210ffb-76d0-40b7-74e1-08dc69dd6fa8 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?fl6DPASH9Sfbq+97Iu+lL+4xuDpJa+1?= =?utf-8?q?FoOnJzh3SkiuJ13CKwlWk3w0K3/+ZFh7o/POfAw7OOlW/xKCs2ICDw4STwyK5d7z7?= =?utf-8?q?C2Qw8S5MsAA613sE8OxoAj9chTk0G1eovSfLGg7B2aHNAKsUTrdLxE0LZjeI4vW7v?= =?utf-8?q?FQ7jI7dx0ouD+mTZZ2YaJwiNoMGyVJDZ/ovb7Ups7Lu67A63LiVOHsPMg5w2UVzE+?= =?utf-8?q?UTJjQs1hwvhyvcMGPN8Yl8dGyMwbwBC+ae4OO66G4Qcf1d7ocnz3lshkdrZQa19S0?= =?utf-8?q?t/xfX8+pgUrTzVz9qQMzZHA+sWoQTVyPXybpHIPHknYBDi4epguB9c1X9StCjZNmA?= =?utf-8?q?+wbZ8RBbOWdEb4nwCum76dkoP6UUaKGaUvQ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uv1BcYjazxRc+V65d1eVSIAaob39y?= =?utf-8?q?wKp6q60CJlAwtGHf0aLUAGIaD+KESmNUJPrYiZNFLjcUgInFZS7LcCt4=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?oVM1bAFOkmQV0kr7LQXJTZZ7W8Tc?= =?utf-8?q?guUTtRoBwqZC1YksO+fX+WWHoyqafja/e6DdPk0rYmY80O4feMY5tpTIOKXiqrBeX?= =?utf-8?q?RHQGdelx2t2kLp1kMC0FnZ4sKXbeWzoac508Qi0ehTCxKQ8aQc08HGrv/d0MxUnK4?= =?utf-8?q?JAglYcqA5yey2/rKQ5CZAvgX5g8acLET534n/6YiKXU/swddedqfAGAlFCSQkXXuE?= =?utf-8?q?KMtJ6D50+fNKNfSecrQ4ZlrsQ4T2FnMk7+oJgNS4DIGVKKeH7BroN/oeRaQV5PdRI?= =?utf-8?q?AHaA8BHt4cIafjqV/L3oJ54zcAkD+ZvpDMvIa7GeUTzYFEwS+b/mlPWPI+MzWE/Ti?= =?utf-8?q?25JMh28lJ1mdq2D9m46YoiPSJEiat6yNTMHpBvQb0CbXCNEozza/OY+pxJwFL0US9?= =?utf-8?q?wWdJjHnrfuBcD+cpQqUTLFASPWLECN10O5KANqr+/rr/Sp/1pIOIqhN4nQTXXUA4C?= =?utf-8?q?qmRVsm0mAELs2RBNNFKpjaajjz3UBfxz8yt3FhXiGtXRuYJ0rzv2ozCswwxwU3vRH?= =?utf-8?q?ipqixkWBiienVzZaBetrlKyR7rOh5yNaZclWAMpxF3HgM2+H7p8GstBiqBQJLpsB/?= =?utf-8?q?M34j8W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e1ZVDLOy8DlcJL8hW5fyIh7M/NVCMzAO7NANtkDawtQs6MmrDBtV8apihdZdr3p?= =?utf-8?q?/8dXq1YpFEw/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5210ffb-76d0-40b7-74e1-08dc69dd6fa8 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:36.2712 (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: eq+udYVAMS1P7iBaC80ablFAPMktGWwiy9wgk9o7vE0CghgI0jjxJABORL/I2/8dOizP02pL50uDDaV5/5qH4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/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 Wed May 1 12:56: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: 794035 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2052.outbound.protection.outlook.com [40.107.13.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E38588627A; Wed, 1 May 2024 12:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567917; cv=fail; b=Jqixu+weRrWhcJkMI9XUCUcCN2ivZsl0H6+sorFNKu017XzebCxoC4p3X0RPM2xDzR7IUA3L431d+BI1FkyXoEyXDUwrudtr4mOO3Vr0nwyJKVghE/D/6FEtr9BlhrKLud2gcR0a8/3vpa4YRYRUsuV0ayKprBuadrNlW4NwECw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567917; c=relaxed/simple; bh=E6ik9M6/qhOWxdXMSi5wfgwa6MozB3Zte/4KB5unPbM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=gSN+PmW6aBIAQdLNdsODjLA8MfCHZ8IPGMqOsPB/LOInznJ6F7LblkZbI3vFMr94EeOAZ+tnKpxSlcMc/U8bMNLZP/d/6ShhH2cu9Cpb3guLR8VX+TWszmjtRKmtcA9lubPhDG7fPnwPp/l94CEzYhqF0svYqkIe4d2iA8Soxps= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=MdQSrfNQ; arc=fail smtp.client-ip=40.107.13.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="MdQSrfNQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jw5DDCtv7NZU3tK78HqPTOg3osCjCcgpGtQyoc5BjkZuBtztM1Vpw/WJu5QEDY4OXrEcsf/m3quDk9+9KtpW0iR+klqQB+7vHUVX4Ih5tbS4gRBARYFjEbFqr3c+5aA2x2Vz1V5alZcatqFLjaD7K6B6H06z0MfkKLaK3XPlDElMxkQmGDNiidtqkbuLOipr0ImlsdnEjPg4qYkqoCk1TPTqdkig7Vdh2f2sd1rg9U0f4Q2J9A0Fct8BqGaoMhF1rqFq6q+g6DD3zFStJM6nPylspzMgANwgU6iAP7hKlS6tOkp9MxsZChlcEA/O5T01+PjGpfZ1y7mQY7QsAmwh/g== 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=Lfgfo1eRxEbatyER+bmKgMu/dCsVHLw8K6gcs7ETBz471Kr51+W50R6pohvyBMwy0bKFG6g9Q+5/gFhpdoXoF/9nu+Q0Ta4JRA4Lss/kzqW2e8TXreaLEnIWduS+wAhcWl3U4133R9EaCVHLVmek0hbNphYvbyEvZ6aSJiTI6L9RWZoJKm+RnDVqjtmJ4kUVFFGsr+5NalFTfLs5JeFhz5yQkWxWatc6sHtYzpbaDQfYP5hs/F4dqNuqKofaZMXbhll8rJ4bvHMegPBHn7lgKKn2FHJfXya7xfoaW7yPDT6V5EvIgIEwAMnuFAmU+119+879wg67xXVEC/MNhSGtBA== 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=MdQSrfNQLjF5mR8tb1GBjL2yNGByTmi3tyWpA1AZM+gT978FSATk9tOjVPM4dFIVVff/z+XBLuf3GC55RgiPSApG/kLqbTj6iKeaf1N92FLF+iU6AJm4CeG1JR+dzJ+VlmWZ3zSIY7jdGM+o5zt3kkDomYegwJizAyqqhdf4Xy0= 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: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.7519.031; Wed, 1 May 2024 12:51:52 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:11 +0800 Subject: [PATCH 13/21] pinctrl: equilibrium: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-13-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=3196; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=HA5FdeU3k8hXGIzvGdYVmDetKxvVIH+CQmWTQZMAMaY=; b=lfIj3/spF8jGcz47ZvLuHp/k/UAG8bMzvdE82ONJ/bR1g1sJUKqcbZhnpbj2LhbltExEhtYGn fwAWX4c8JfCCz2+JBRdYekK/IHu0QInM17+/HxBCQRu/jEpaYiPq74r X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 92041057-bc4b-46e9-af55-08dc69dd7975 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?ZgiSAayWdBXVSk14HD/kC7zRi/aFFuf?= =?utf-8?q?KnHNO35K2itukwo2uBNLYlyrY62QT9ZvftXKgWJOwakG7tO/KPKwl8XmY9oAei5xQ?= =?utf-8?q?vrBDPYj0bXTVtGpxKYSXGVR1T6GZfeRWsMbMCT0xPkLvFGvic3JiU6CixdWk7Pkli?= =?utf-8?q?V2UDqJq3m0Ld1HpY5VBeQAe0Sjs0aUOdNMraayxSOtDOSsHiX8vT+LW9eKR9BJMyO?= =?utf-8?q?iHf8EJ1SiJvCrAgY02DZ0RqmIj+C08YxynJax6fZfV32021pdU0v1cBicqXxyCY6c?= =?utf-8?q?i4TZKhwWT0zJlbnMKaCl3t6AXJ1riDVXOJUXWo8S+mRgLXPDTiZi6EdMCS+dR5G4B?= =?utf-8?q?hAGq1/MDbzihfZcD9eYAVUteyPAnpsVTAGH4oXFfJnttyCQkzRTyCZjxTs+PdPyEi?= =?utf-8?q?CaRrv6NXwCif+c3YLr5H3EcPg7IHxiHEwNjYpj22UpSR/XrPwfBFgSOZ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=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?XGclJIPnHASPu98kRGny/gY4sriZ?= =?utf-8?q?AMDorZ4cp94zSw2rt2IwpJKjJo7qVvfX6cBtN3wqtZoqvEWV4LD5jlPZPzgURn2b7?= =?utf-8?q?Cz7A+eZlQpGy9tWXipDvYUuKECS/Pgy8Ll46aw4ipb08dd0nnmHH9ntu8y8wFEHac?= =?utf-8?q?H6sFn1uySJFHbj00ufR4+XMr3SMz5A+bWNiTehkwZyoTVLlOdmPPxk4iv8yS3bUgj?= =?utf-8?q?fEyfou3+PYRd+dl0jsXwpf/XC+WfuMZ6TrVJnLI7pPl5aNkaYQ5m23F+47R/mhF7Y?= =?utf-8?q?M0zKCYNUjL8c/343W+/shcpfBrEWEb7d8dI6LawnZWZ/oOn42jtzG+IvasDTnvR/d?= =?utf-8?q?rM1fJ15eVPokIDIOD6FDEh2IRL5kJ72MtPHBOSTJzChNbDtLgzj38LTEEW8PwhmEX?= =?utf-8?q?TqJd8b9qX9DN16OU5oqXJbonjqM3kxghg4sR4ZZFX431wfJtoOHgT1tPLfeq40GR+?= =?utf-8?q?d77+8N8J1phzgoOMn3SD6dyCtj4YG8QpI5bVumt5XP+oDOq2IeceGv+0+KomlDzSM?= =?utf-8?q?FPvdH4hgkVIj7b6B9Zg+j4W4+cNbpHBcNjngaFAVjF7bW6/YwfM/XR9u8A4fvjgVV?= =?utf-8?q?OYqIjWN4nVo8OLQYODyE+cwxiMB5XHxHaFpIHwnbspashyKc2vBj2EhSfD6iMou88?= =?utf-8?q?xVPpGUD/n1NR48jliMyrUnr6QB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Org: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92041057-bc4b-46e9-af55-08dc69dd7975 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:52.7250 (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: s+rfEts3EMc81tIw3DREulmqQte0GY3zYwWn916xq0atBwEVif9bJ2z+UIQZvnefYMON9VG8LKaqgf6P9Ep3yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/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 Wed May 1 12:56: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: 794577 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2047.outbound.protection.outlook.com [40.107.13.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E2DE85C66; Wed, 1 May 2024 12:52:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567935; cv=fail; b=rOO7RM5OkcC3HmD4LUbD1PeGnhFFmX5gCMFkIE7EahJ/j9lrkUnRaf3pdADxBH+iYdrW6f+RpJGK1DVCsVhYoyHQEocVvMBeMvZUelNApz41YMZeDfWQ6zEp5qFTg1396ANM9/thTsOgq8IEPkaj1//D32fix6zrjaiD948HZas= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567935; c=relaxed/simple; bh=X8fef6zB8RQgo+UuJGH28YE8D4qstSLlPE2UStayCOU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Vt3qaXjzoox9fugqyypYLxfVaVsI3D81Zd5TJzbRg9CRsISRJOAe20Sx2gAGbzBCKq+kK8G4xOwDolWJAdlyVwX5cBP28JZffdnGTo11hI/i7mXiiE2UJ4r4+YaPFfcn1ffMicQZZpEcNmaHXzJ2DC+GOE9n6PAH+Xym/RpCoIQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=ZKYeqlWL; arc=fail smtp.client-ip=40.107.13.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="ZKYeqlWL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FHKYXhSHTJ9CRRmSXyMxJ8eBbJfoWIPRlZumxz4YH5QTfT5dI7D+Y8O4KDmaMZ9NgmuKvxB5wLooMj3JBPKgQSSJO5D+/Po7N/0IyFud4OQrNb4X15VWEiVo2CL8Hl5Kv5/ijJMOLUS8LclOOO/MSqNjBAW5taaChz+1Wau2zk48XrOB0taMC3wyqkMwf/X0LZq/7X4sJT5yN8QTw11DHvqw7+t/ZEqKk6LLwnx7mu8MfWBahI+VcTPDPwVoKUAbYyh8COb4EFodLjTUIsQbt7w9sqL162/i8pkwae5+FwHlr64t2M9OVqw0sInjz54Z20FwEGEuBwHCiJ6bTuDIzg== 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=jwSQeOuBtaXKgwm8vbTLzd1pc6GMs3D2WpIMolNx338=; b=bTqFgfRXnYWK3gHt2R66SDy2R7ajOl+qz5hjlLUFEb+3gmyv1ZPuEa0VasK/8MDIkU9fgO47zEfYMovP9ocoOJYf7Ms+Guz51h5mIJoP+WZlGmRKqi9SDm/799icLa1ujVDDam09soHWOVXaG7eIzeA5o33Qd04C2KY5e0dBIJW8Li2FSyhUehy+QZV6BR0CHpdypBARFczkmfdXUagwgbcNwjXjJvZPbtSf4FsLgvtrYbfKg4P+yELmVg3LgIcryCpTfGP0r7nR/UlMDEO/wR/4z1qThrSp165PGlr7JYR4B7CiD8ZI71U+gTR3PdeuCpqaa0IkkFCMpj+BkSsIXg== 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=jwSQeOuBtaXKgwm8vbTLzd1pc6GMs3D2WpIMolNx338=; b=ZKYeqlWLS/AdM5XC6NCh8Rp/qCNsPRMQn0dI5CNK7D90agHFXJpnKWO3O4ZsihfG/hms4q248fRvH1ghI2cuuI46OykyXNokFJ1cpiXAQ1iJVBM/qY+5QJAKOHNBmCIiGTuDlDl92XraNhHzQ36uvQTDQz/hQ4zsN5Roz7kvz0M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:52:08 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:52:08 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:12 +0800 Subject: [PATCH 14/21] pinctrl: at91: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-14-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=3508; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DsW52PKsk9s0VQOO79Vygj7HmsG35ZlCr2kUzApk7jg=; b=1cdQjjCVZD4XTvl7jD/+3a4DFvCSK+DbvouTIkodDirgS/P5DNB2U/LQnNk0QE9haDZudVF3v E+GOjqUPfNdAbyJ5f1Dr9PQyXKF6GnAn1dpDh7P5hmY2qLKYBSab073 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: c1a8b2ff-c9b0-4825-dbda-08dc69dd8302 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?/+UmSXQkdCvAH7xazB+XKVHoY1Lp8Ce?= =?utf-8?q?8uvi4SR+zREfsPfm8rFwIZ8xRONQaULsJ7/g/MluAowRdlMNUs3Dek4GZpts5q6Gy?= =?utf-8?q?LAeXpXcpIRWUbRjV8BQJ/fjQrZ+lQEqjLPH1HEZYxHVy+f10XUWFWsh9UJJfd29FK?= =?utf-8?q?GQtOPCxdyrMl2whBL1Oxy56sB6h0foS0tdv9cyPTWBKwMMs+1v/Y0smJV5nhcPY7w?= =?utf-8?q?/B7ccMwMTGYkuY40cipgFlwMZ9STB2t7uTU/RZlo6W6mQkurJU6v/W9EOEYz5AXyX?= =?utf-8?q?Yx0/eLMVhTfvbEkhTO+Hm7A+V+0nW/zEp41dcAN6lBFbj8R2eroq3ZZPHpW7V79A+?= =?utf-8?q?GyG5XDswzMkb4gc1Ao20q/DIrcVbOBDZ/U/KMlbWluNeeBNwXXuNXsTCMDWz6NrDb?= =?utf-8?q?NdTJJS5u9F7PRvJQqVAMLy9z7o2uzDzwJQIZ3pEQfdlT7XCK09X/8csSed2JJHsGu?= =?utf-8?q?/W/0B+G6Z2bgoFn9fg5WTf8QdWj2Pb7IAiRond7ZAoXcE2Fbx6DRZSzrhPdpE5zhs?= =?utf-8?q?McW9EIhyNHeQz4NPRru8RrWhc8PteGbhS0abo0l2uu4TZFwmRy47FaIEXvYIA92aq?= =?utf-8?q?A61x4/TV5mW61rMMD5bj3DeGLHhAFs9UxiHucVs6JozQMUZ21q+n6K8bjcNf4hc4n?= =?utf-8?q?srR00+g/qLR/K6gIkrpEIVyrOQ4nyOgWbO0yr6LXqRqWNyvThgHnEvDiGAmOOsC3o?= =?utf-8?q?UyKQH1htOa3zXEdm4ZD8M2jrgiHCpfxzgEQ/dmW6Gooqk4J9hZ3ak75IBZ2QxFATv?= =?utf-8?q?bLYI4H0g43yAZeT5ps7iwFR8CeViqbMlzbi78vtgBuSdKYJpKBhMLKGfNTxU+DW/U?= =?utf-8?q?AH8ZUQH3kbZ7AkcEZr1XZvlqNoYIozJDHCA1Qgy3CE1tkUEjURA3jrruNqz7dGDqy?= =?utf-8?q?7ZbK0YWE10nMHR6HtQOWP0ZykyQdUBSyMDXjjFrKlzUmPCaAcqtFP8nr01S60h8e6?= =?utf-8?q?AvOWVOWtlN0h/toNkk/G6u4vSk4hxB8puQ53Cjgk/nEjJB+oID+lzhRtRuYXkHQ17?= =?utf-8?q?Oy6ZTXywo0f5YxxH8BNE6p8+03mAbIVfut7rC/7InXnyhyTy8A5Hww9ZDSNbUauI3?= =?utf-8?q?5MmyU1X43YRlcT9L73QhZUj/ccV6ggA32wlicV2sgdMne2MpoJD0hX58Bccx4A5Rf?= =?utf-8?q?taePUbvg7BT02j0lMmOJzh9pXXRmpVUuGwVkGjLPJYYCtY9tjvKbbCNx8yzVX51Wj?= =?utf-8?q?FjvNwhxX47Rk6XLUKZUsSV0kHAPgUQ4ltdtsjsfqSBxVHqxG22DxOqOt9YiWdmGrQ?= =?utf-8?q?bNOG+4/cX4xTxmVNfN02ezMs+Llox3dCSwh+MBDAdFOrHToZopR2izXM=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-Chun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up2zz1l2o5amXhw6W4AHjKuX/ncNK6HpO6nxjDdzZKlILbwotKlIvGYc2XAT/4?= =?utf-8?q?nJ0mZUeI8EVJs+2SiNPNVgre9Qu1F1zMaqM15mC4jn72+xkmTb4iYlmUzJ0hhs4lH?= =?utf-8?q?3bXVqby0y9kc6AhtTHgp8iokyK4i3z0JjLwKqOgObbw4iucYwDrpJarUbajYpIRYW?= =?utf-8?q?hPIUyLbsBaR1iZTZbgNpFNWAV8Qb+zXS3Yy8Wp+e38u8QPxjDOGBxC9J5Abc4ZgqZ?= =?utf-8?q?NPo8mzowIyEYvB4jaMHNUWaOySP+DDc0CJT3VGA9Pjl2iA8PED4Oa51SzCjAzeVNe?= =?utf-8?q?K6P7RUzWLASy4NEP+dtQZCDTDiVZCgnl88AUsdvL09yjEbHuBd+ze6aowWEjq9bq7?= =?utf-8?q?5JV2ZOxhGwuE67hAh62wuUZSvJXJwM/USXfBZsuWIXP2wu5WdJU+pi1DjwRkQmXVS?= =?utf-8?q?RXvGJk6gx7jBeSyj+JvgNaAkhEis8ilBkXyh5jhO7w4sqfhnlD8fk/T6b+5PEX0jy?= =?utf-8?q?VQu/rHgAjIc1yToXRuEli6uBfc1oe/3bWLQdx+yZjN52zhgQJkc7pnCGFKizuhEoN?= =?utf-8?q?9150YtPCkSX+FaCu5JcLS/6+Xv9JRgh2YiBNZFpB1DFvr3IJjqgZTVfyxfUJz5qDO?= =?utf-8?q?dlyUfupEY/NaguKxPFe7+ahZDk24/2/HLB4xt4/69hT70yXHqbLtGlzowYzrVBdjG?= =?utf-8?q?CrMv5L8Bk4BM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1a8b2ff-c9b0-4825-dbda-08dc69dd8302 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:08.7592 (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: +p1DJvd9ZG11gV5c3BC+frDLn4qMRBqxL0203eoK/HfYhX4xeIDB+3pmdc02l9InHrExMp4T1fUbWYaVNVbo6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-at91-pio4.c | 7 ++----- drivers/pinctrl/pinctrl-at91.c | 17 +++++------------ 2 files changed, 7 insertions(+), 17 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..cc32db0797e6 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -292,7 +292,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev, struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const struct at91_pin_group *grp; struct pinctrl_map *new_map; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; int map_num = 1; int i; @@ -325,7 +325,6 @@ static int at91_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++; @@ -1244,7 +1243,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 +1265,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 +1292,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 +1344,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 Wed May 1 12:56:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794034 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2048.outbound.protection.outlook.com [40.107.13.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0C688248B; Wed, 1 May 2024 12:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567949; cv=fail; b=K4/I7k/MDx/EqVWShZKaALnJOmVZC+Dne2LqdztdzupOEvF8RWEPxU3L7BlNtgAEhz230eOot9rKwUkhYVa4RQrzjdytaCFWUavM7CCu7uVe4+gE1qdr5j5ez5Pjj+XQ8rW7x8kTInj4e+SPirNfxtB2sjUzVtSSt+717mUFX/E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567949; c=relaxed/simple; bh=XjYcrC4knEYcZi59FiMv3CxGYKeUFr0HCFF+UrzXVqE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=C7CS/xyhVJdDIZGXwckRPg+xWeElFQ+tcBHTt1i15JA9jRNc8LtCs4xGzeAtMsloJXA6sqIDmkHh+wZCdkMDjGQcjx1Qc6v8D6faXFvzMjgZ5B+Y+isthRtEeVGBERtuG3DyoZhoWKKiTd6teL8iXLElVx8rgd6P8xGbGvdxHA8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=QjwVmU/P; arc=fail smtp.client-ip=40.107.13.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="QjwVmU/P" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P5x4I8tO37vTuLowCXhJiaid8AwCOcoxxu/zGp4ZyrGMkxDO6AKX8SUWqory8nsXdpsFEwjGHClK4ZA1ENF1d7rDOcDdcaFWAPJAJRyMlqg0i5g8H+qUB1MB8Ro01CGB1N9RxBkZPemvk5N+nMcDNvUoOC1UtjVjwyhE3Y3CwUSlvw79VaSqUzaCnQ+c8Di3vWfeXupVbUkV7qIy9S7dMQxgh16qJK53j5Q4zu8DL4eINPaQoL5z7V1FUudYvmgXS0V5pC/zcXvFRWuzvcc3/6wvcpE+DInJsRtGhllw+dUGMBg+b4uaD0Z0M9jIgqVNgsai9u+ksdjIRPv+SX8kDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=Qp7YW/KqOQ1dIuAeuLX9G9mKYCeQKb+ZdgY2Ckhc8HxmDCRJQAlOUzTPolmRrFTOOGn7PcIuVCLfG7U5S2ujSfjhRMzgPptAFeOt15NSFlhjoCMNWET5N6oBIBQQgiHUNdVLQ+dnrZakWh6sgp8vK5qajqhcr5Xv8uzpf79lqfHY4q4HZiaexfu2C1pLRWj3yB9zorFALQsIkeOTickhhqT2hKi2FnOqwgSgqO8dPNzeVlv6KFZCndCXS1nnNtGNXPx+UB1yC9EafPI6OegVC1pDkwATZrILcAqHwoMzz6Tt0YE1d5EGg9wCIk90WhAWwmlu1iHN0MRH+ttQV1NBFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=QjwVmU/P+0pzdS0vwdoB/T96EuMtX/O3xazwcaD85Z/GcJaMJFO/o/vL1T8VCvSnot9UUwnYtXRBugi/l85OhU4qT8T4XznapKMfodEUiRpUhnLZVy5R3zk5Vzs0KAUchXBtiFzgERFIVIdrFy56HfHYX7thUjHtaig/wFaSuVU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:52:24 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:52:24 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:13 +0800 Subject: [PATCH 15/21] pinctrl: s32cc: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-15-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=2925; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DE1TsODFhZuLZm6pDc3wReEJgqgWx9DxsgygoDyK3OE=; b=J8lSkR7Mx7ujJcqpDBCl4JEVNUPzdqXFCjkd8xS7+Ni7wVjQNgUYPHjNQ2ks4qlhJDcJuza8s sA8SFL9MSd7BbyS9zzyC4a0S11SP/gFWHH/lRxj4iR9+ll5Jb2h9ei8 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: a105c504-f42e-4153-e745-08dc69dd8c91 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?LElB/FPPZ9Xe/bpyL+ewsLdolpBFVCi?= =?utf-8?q?RWO4CSa6J4CCyVAzV1fFl6/jScwmncQU+b8eDBIdLk2rLuGKpA3Ma6TuQKVyVROYj?= =?utf-8?q?UX6Mj6/2pQsuAjAcdk/mmb1tw/jot95HLDzKFmj3QU0gWNMRpMGiLxzDbtzHmaakX?= =?utf-8?q?yleEOaCuBRSGe8S3J/g/5hAIK/bsUPW71gZ6+ipxjtAQ/yiYqwBRPcjxBEelDR60u?= =?utf-8?q?p0jopBcRqcGOzdZqX7VHFd4Udn/rdmypBZbeAA4EfBH5FN23k/lS2UvvJ+DhyYuwq?= =?utf-8?q?ruL76zkQDIwdo0kqTyUjcNhSPVnxYfjjLnXMBdJG0lRelJ9Ht2lvV7uARw+yTLpH0?= =?utf-8?q?19+/xYCtn7/7D6OZjH1XwMQz2fFlID/jjGcmO+eEjMgp7URjwgw53dsE5e/6pnW2A?= =?utf-8?q?REvSHvIg8gW0P2kApPMTxspgRyjBQDQSuQA0aeBxGB2eeYQ5kRnfRirP6q9tcfaAK?= =?utf-8?q?sLOfGNb+HmGCuhBgay6FoVJUUZMCxJi0KojWt6IXeQQzrKU64OeafvaFLV3bLjRzp?= =?utf-8?q?5cUDP6RNJk9XGgwiLTaR2CW0x1kTjtm4C6CY8GfMmOcpMhWSAlrNrTBfl74EdGXFW?= =?utf-8?q?FmIekV4lYFn/44utLlgTOGf9iGMEOCqm+LgT0OEgWQzC+G/DwwSOe1lLpUas4U7tO?= =?utf-8?q?M8st2iAJDeUDOTAV79wnP8nIpzIU6TamTwtSzSmM0y7c/3+rSUZwWww4kjlqIyf82?= =?utf-8?q?GAZicmj0GYWUuWQbV2I03Oy88b5iIWVMjnMr2aohN5FS4OAtwDSyZC/LNEdZM6U+i?= =?utf-8?q?0RMYDSiF591EO5Jhii123iuDmXydYAjDbzgfcIgC1TaLo/MlPhA50TvGDRlQtkQQr?= =?utf-8?q?eKpvG65CEn8AEvyMXkF7ppjr2f7Fnd38CWyTUYb2vLBr8/0kr2OXv6ug3dSw/xRMJ?= =?utf-8?q?7TIXP7lYaxtWnjrGsVwTPhKj6dTJkpmbK2MDGl7paEcJXEAljjnPTNOxUgO+xGUS1?= =?utf-8?q?Sbo8VUVzdtUIxMX9wWpBvD4SvX8XRhWG4y6pkG8Eu3UvGyFXpGBNltwwp1OKDAekn?= =?utf-8?q?q+PrfeK+QDHH+LTNXQ7wMQ1JrMgNNyuqmYNF7Dx4Ph9ILrHqbocIl9gNmfvb2DIGk?= =?utf-8?q?5CM29xCFMvIjfLiAAoakRQEig8Jdz1nHduBhE1OEcu599bc7kPXZE/MddDVPecBT7?= =?utf-8?q?1nQSYtRy32ouZT2ZPegIp/mkMH4+Y710ihODS85BvLbBgq4jSEc2gJAC2r86Csm/D?= =?utf-8?q?z4/KybfSk54R0Vl9VOhOlkqPhn2X9iH09+nQOTG7heScZ2y3pt6Og4VFvQaFpTWbc?= =?utf-8?q?mZKA7YWv/vESeaMBQDSDs/0XWpe8qkZXxM4dmReSEZEojKxrEaZOMa3U=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chunk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1nDbWT7ElKE90sOKVNda4cS28+4E4V3fpu3oGmerVAKyyi6Qhgal82C?= =?utf-8?q?Y5bThdos8m74vQAGgwSf/HDxqfwRFnDwoXeTrd2CgYCLbA14q3XUkK4fJLrfvsekq?= =?utf-8?q?1S3Xz6MNsBcOPPshl/HyGcU1B63zBS/7tYvwbLo9N/cMDVZd8fVGblXTiMNvQTCoj?= =?utf-8?q?xgdSeaoVoAUHYx5oMQ+kn2cgV5xgn9+0vBgG+N1AL32aEtIQd9WGA/PBrFxk9o6tF?= =?utf-8?q?o/yye79l7Z+8M+7lVn6TFYvPJ8tGTnWGXIFPj2OiIwvnvuj+i6qbMT1q8peFz3Xrb?= =?utf-8?q?tAbrnwkxnOJRVUOsbnrVzXRJ8w3NCfxXRME4JOJx+KbkhWq7zm6WBlHfSIY6mrn3r?= =?utf-8?q?dc842CzkXXdOGYIlcZlph5zD3T+CC9K3KTM9NlNmtsVUm0EczYyQC+c7ggCnnUJ0F?= =?utf-8?q?p2jc5ze6Ol08ISKjrs6poax3/yyf51olNcWTo7/6C5h3XeKOfxgS7DyyW/ccdDXaR?= =?utf-8?q?qt5KH2GaS57PyrvLqVCzj+WG+PqGmrFfjHplMmWcvT6+r3ds5T3XkvXq2iw/7U5dY?= =?utf-8?q?Jd0qdRCNec84dtF06xO3zIEuxqYI8jNCbsY2CzSPjNdGV63fyLOE7fHN8yWVf2t+5?= =?utf-8?q?bM/h4TcS8eQIxJLqx1+448CuAT4Gz232AHlqxFQVotE0aIF40IZdQG3EVCCc9v+OR?= =?utf-8?q?rmYmPksMogL/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a105c504-f42e-4153-e745-08dc69dd8c91 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:24.8089 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CZStkNJGrOCQR6h70iowtdqpuRv0/HE6bewRFs5vat2TN7ogu87qOKaglGCwTHgwSua78d9w2wAeVmvCLtq+CQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/nxp/pinctrl-s32cc.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index f0cad2c501f7..df3e5d82da4b 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -268,28 +268,23 @@ static int s32_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { unsigned int reserved_maps; - struct device_node *np; - int ret = 0; + int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_available_child_of_node(np_config, np) { + for_each_available_child_of_node_scoped(np_config, np) { ret = s32_dt_group_node_to_map(pctldev, np, map, &reserved_maps, num_maps, np_config->name); if (ret < 0) { - of_node_put(np); - break; + pinctrl_utils_free_map(pctldev, *map, *num_maps); + return ret; } } - if (ret) - pinctrl_utils_free_map(pctldev, *map, *num_maps); - - return ret; - + return 0; } static const struct pinctrl_ops s32_pctrl_ops = { @@ -786,7 +781,6 @@ static int s32_pinctrl_parse_functions(struct device_node *np, struct s32_pinctrl_soc_info *info, u32 index) { - struct device_node *child; struct pinfunction *func; struct s32_pin_group *grp; const char **groups; @@ -810,14 +804,12 @@ static int s32_pinctrl_parse_functions(struct device_node *np, if (!groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { groups[i] = child->name; grp = &info->groups[info->grp_index++]; ret = s32_pinctrl_parse_groups(child, grp, info); - if (ret) { - of_node_put(child); + if (ret) return ret; - } i++; } @@ -831,7 +823,6 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, { struct s32_pinctrl_soc_info *info = ipctl->info; struct device_node *np = pdev->dev.of_node; - struct device_node *child; struct resource *res; struct regmap *map; void __iomem *base; @@ -889,7 +880,7 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; info->ngroups = 0; - for_each_child_of_node(np, child) + for_each_child_of_node_scoped(np, child) info->ngroups += of_get_child_count(child); info->groups = devm_kcalloc(&pdev->dev, info->ngroups, @@ -898,12 +889,10 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = s32_pinctrl_parse_functions(child, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; From patchwork Wed May 1 12:56: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: 794576 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2057.outbound.protection.outlook.com [40.107.13.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 217D88248B; Wed, 1 May 2024 12:52:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567966; cv=fail; b=K9/9wTbCXn3Sj25pnxFbznZfG9C/XfxUWXA26lulzPmj2bq9udy1Q6FThfEZtZTa3N1Bpbiq4Q3zZXl7vyuLsvDRqv2lyutyfwW1vOacS/Sgyg7hHZ9sxMlkULcgA8MiH9gatXNWnoetgzN+7CbhYWXOvab5oqwF21K/BcPUEp8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567966; c=relaxed/simple; bh=UYDu+QLrZ0SSLpWHuRHRNNZ73xp3uVF3FfCqwL6cAd4=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Tey3zYjcp4nn8Cct7wn2VpET8PHyQHmNBCRwc1nxmGFCph1kBa+TY0sDW0fOAbnhxsZmIS0HULmzz2hZYhW5r0u58e3ibVs6eRahkhx996a6LjI3otzbvHDlSj4EOXP+yH2upDgYM0ZvNri9dsM0HBgO5V9ieVrqC86fHqyF3ks= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=XcMBz3RD; arc=fail smtp.client-ip=40.107.13.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="XcMBz3RD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XifoDNFy+OIEK+L1N3yuEmV5XxdlcDY7VEDXhd6JFqp0mpxPhZgUdo/lpIIzxLUjnMymIYzrtiDr2hLLA3rzjrgq/8GkOsbEDmKLr78QTf0iKZ52N056amWTpcs+ZAs3YVgaLlq7ieIN5D3wZZlNqMp5V/GzUFJ6gs3uvQX8G/AD7+y2JQuYYGXTXWKPsn52JcUIaZIF+MqOJzB6jriDDfq+G7OIVLt9ibhonhCJYDKu4sQ+aIIpiHC0XcZUW5FE/PyRGH8+4f9lLMxavBuIGzfOS+Pm9QdcJaQltYRlmozL/D7bbK0GCqME9v9sOysSlKmpVcL9DrApXCKUPtaxjg== 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=Z7XszxlL7Cd4EqBxsGRR3c7nh17exvXRKG5Xc86hzFyVwP/5aay1BDHBK+DdQXPmsrW4gmO2TBJg673S5e7cuyfZO0fcJAQhywHN8IEZbSyCCh3xqa2naV2TdgAgk9TrwG/r1J70m2/09XssXrwm119ZbG1BB0GseRt0G2yeqgnwpl44wgS5IuThMt37c7yJ21ayN9dIzcsVo3pKrgQUbEiuNAi5OfHSYL8gG2QNtmaZ9Mqn5a/ksZRu4kxiGCb+vZIdyDSnJdAblYBSaJQpQ+L1QHCOfz63pEvcSpuQXv2h66J3umxzYO2fI3JoTnPJ2uW8pVYIULuMsaipnQpyzA== 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=XcMBz3RD6J+BpOdQUcC+tI+ZS4U4ar6yAE7Ic9ceBZh00UY3Vze+v4QW0K0dkPqridb/N+uAh7bKF8b5WPN0leb/tl3uFohVjl6otL1ESHh0Fp4zJjevHJIRkCmhaGh94Z9Ay99uQcPquTMQ3AYo8wKrs8bs1ljsDXEQ7TopfBU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:52:41 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:52:41 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:14 +0800 Subject: [PATCH 16/21] pinctrl: nomadik: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-16-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=1905; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=x+RKtlqeCysZbUAk0csydxI+b9I02cK4F7LOISGb+DM=; b=Y3+vk3f43AcNvROw3kkX4CgId2lnsZyoUr4FCfrXbQW+2RkiW/K4kuVSb4mcgJzb01ENb6OLL Tw+jfm6cSIaCjvByic6cwwOvm+A9nbuy+hC5xdMXE2JwFxQPNCx6NMJ X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 338cf59a-6dc3-466b-c9f9-08dc69dd9634 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?GbshhS8PiNjgPh4IXLtVxGbP+mZsUMj?= =?utf-8?q?FRrykmuDUUAMUP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+GwsR9Cu8yKQCV2AKfo6GJJyW+KTJI8wW52cnP7CuHXA4LAaYcM?= =?utf-8?q?l9bP6vBSXDAeQ/EGeAFxvKNzpO+CInL0pNfd7SEG9nhCjrNZ6zp+UQulbc6M7D5jr?= =?utf-8?q?3wIiz6BJy7NcYus7szJxDO3RG2oKklQXSmyfDr8EZZiDMImQTvEkNBC2Fy+gwu4ue?= =?utf-8?q?0HbEOmg24FixT2gGstHTr2BU2NOGkeuACEEEwoFlBSlbbdR98lhCGCSfnUvGt6ucT?= =?utf-8?q?7bNmYBt/Vnv0kAzKkyJ4g5E0vKgEmGnL+LBp71W3KxtG22Ea6n2jwyBiZnjUoL0YU?= =?utf-8?q?Bg0+PsqhpHVEWNiSD2DVUyza7xQ+I+5T3SUATDQBHqH9u86Dxc0iYIm5VvT9E8eP/?= =?utf-8?q?I0te5aMjy+QLwlWKX0FsqVNhK4g4Qmg697Pv+tixmnDym/hgDpaOxjnY=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?JiwfMhPPtEWrmDRh5AF8ydrtQ4Gh?= =?utf-8?q?hvaA9akwOai4kHrqhleme4GMK3Dd3Fx64q+KJWF0BDpiMVUPhWlhHA0DYTEpRQC9r?= =?utf-8?q?xP7NSiES7jDRzs/MOBb8fJlLUyISZc4M0ZQ3aMyCBufKsFc738s8SluYG4cq1CRq1?= =?utf-8?q?P4QT9+KkwejWov4W/FUCWJuRy1mA1upw+5DHUosXzwGbKk005qOUiPiMOYR5r3PsE?= =?utf-8?q?wt/642+be9CNoKlW+IM/snaW+as1ZUTB+mqoofPO9YNsI2fxx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HpTsdiGEqL0Tlp+U?= =?utf-8?q?HhT2095e3GU2eDTdJin632ANrFVRt1Sp21x83BvUQY27McGeKQ9tcscvT4zyswySo?= =?utf-8?q?s4sAE15JGFzckDBzPUJiHdJ/MmcfSUJdz9IjM6bzZgnJrY7iW2AJe+KUUjLB/JTIl?= =?utf-8?q?d60rmBhLti4jxkNZiwNQbktrUQgGkkifPCla7ZPUsb3G8O8Jse4tQpEoizUyYtu87?= =?utf-8?q?owU0O/s5swqfYebgUUP0W8ORbBoNpKUzBrV8ap+OW9ZIlTuYBGlpt5EDznLq+Mkit?= =?utf-8?q?zpuhM+kdkb23gIStO0enc+bpW6tpLiBxjgqcA6PAOJ3F/nooTOyds6/TfoHitIQUR?= =?utf-8?q?3kWTtroVqGa0EfOr5jm0KjPzoXTNO7C8L0lepGQeqKXALoAMiT7jr4jXzoX4poFhY?= =?utf-8?q?TorRV6AI0+rv?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 338cf59a-6dc3-466b-c9f9-08dc69dd9634 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:40.9503 (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: 7BwTvFoAifewf9K//sLx0gnboIdTV1IhnrFyKGTjhX+6geimmswC0t0O4NdJwAILhii90JVZlNfmHkLVmbObVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/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 Wed May 1 12:56: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: 794033 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2080.outbound.protection.outlook.com [40.107.8.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FD4C12AACA; Wed, 1 May 2024 12:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567982; cv=fail; b=LRuJzlQed62HDdiTUETeaO2tia7URAcgGuOnvTsduQUNhWzd+pIxLmAog8a9VXN8F7iKFFpkxoQp1t7qg9rmhGU+Qq0LEn4OVsgI5iCpWsRd2wHEZtwx7KsJPaYyAY2aqZuIM5LraiXr8ZtM93BeOICD0zJXzooH+5t+Q0mwRCQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567982; c=relaxed/simple; bh=aGocML37yKFLTQmAgdHIf5uoWsvtHUPQJME8EyVoT6s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=GcVYZi/8qxzKcEbgOEd8ywBiG3t9m288Kscnsj3YceEw4YiiJKCQ9mkAKQDD5m6fu9nKCP5wRScUf6gKLBHFyhMX8epziRJ5fQnAEoQFotuxGgqoWKW/ym7NredMLMBadkOOq5oSEicNcrXClgnJbH9Y0ahIBWcTHpq4FvL9cTI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=mrDsVXkm; arc=fail smtp.client-ip=40.107.8.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="mrDsVXkm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QpUpPWj3LUslORyhU7NqW0Z4XFf8H/CovD6oS76C+83yPoJscaMhBLW2LhlsK93q0el2gXTk0ZbrBtvUbvpSPwvNmYVJ9xkoIJMA628vKB4qFl125ZAyJn18sxfB/kqDJck8/qKmPYvWRvGVUNt6tDsJUPQUdihY61NiYKEGc5gJ/fSAL1cH9VZhPjghPD18l8p0YoH0Hl5n289qckXtQAoQIB5hTgGSoU08IpLOgO7NXPWFmou4vmG13slj0KCx89o2C2vQWizE+1u4twKLHbpX4rTWKTZvx2/QAnq4UvVb+e0X2sQgN9NAtHXmrjzH7cabLT3P1u7T8VqUUorFPQ== 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=dZtKs39o1PgE1rl4YWTIZUQxv2i3w+xckFaDakRDfx50gW9lAyySMsfFSidtvbgOYhYCmUiR49C9yklB3MVOQE2uIrdfkKRJ4X6nGU+QJjFRBLAMh9G17WT4fxEwHNNU3mPD9hhN4WHKqAIkSdI8WPYOdburywYAlmOuUhUEYYkkpgcfOiVMuyjjGdBkIi4tq8oAnrL0S0yqBpv+gBBcaRLRxxpuyCVlMoAbtzEBLhHvV0bRNwKMPL3NTI6dMYnstGuCpkZwMOyRIEd9N1gqi1lkiIMJv/IrotZtDCD6yrYE17ogB76mReUZSAdKKSs/uyMG8Y3C7OLQ2xpvHsd+5g== 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=mrDsVXkmUtziBoSBdjyLep7uqWVO4X5qKWOAYEszWk36fCksuvbygikVuT8Kke2s27TrfTKtCT9NqFDzrHvOX1f/wH/FNKRRKsGUC3x7/eIzJk1gY589zToZeZ4iLFja9Y3sP21qyn3B/9489XAxhk6jZu8+dlmncv7ApZ9gRZo= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:52: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.7519.031; Wed, 1 May 2024 12:52:57 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:15 +0800 Subject: [PATCH 17/21] pinctrl: mediatek: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-17-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=2143; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=lm1PEdHATfoxwJUL9YMs41GxvVEK/pacMdZ5mWFlWX8=; b=9opStnvvifVa3C/7Di6MWEQ5dybv+YMYe/v16eI3vkA8ELbqt3EumCOS/cY4boy3ZcVAxR+Ys /w1RPbIr2kdCf3yCOuLiSFTt5g7rwevE2UcF77MN/YvcE4IrIOWCqeE X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: f1a3651a-3d30-46cc-ad5d-08dc69dd9fc2 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|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GiLW7Gm8BqH+fUZBSR/cAG7HdnrlKOi?= =?utf-8?q?jIjpaRvsoMOS2gn31bzkJaqJ2X50OklDy1mTx+mfUz8HfR5u0DKPiufpF8rYPTkHq?= =?utf-8?q?kJWakGNKhoeHS8AozQK4jvP8khHxWFuuCgyGvliahTKghNtmuTn/tfTgczlyTBKd6?= =?utf-8?q?Xmqy0eat/N+wkMYSNJMs2aeG4cvOyhyEQP0DPNQs2g1BRk2WMQHelJUwPYxRtlOCA?= =?utf-8?q?n0SGTxcvSk97J9nA2HIf2vsL35VqRv1GkR+EadO90wvxL8qNoU0LF22iJzLCA5Unz?= =?utf-8?q?M14WOEwE0V5uZt0aC7ufUTsawKZno5IkYshLvowvT2qbanNqgB7+OSSrlaHP6scTJ?= =?utf-8?q?4rdfLohjurdqu/SZfLd5fjf3eogwqBZ4OWU+kH/LgKHxD6WcE2Dj11f3XbCiSqxHT?= =?utf-8?q?d4x1lopC5Y1x/pqak++4Wx7wQ+PrAdSFcAmQDoD+SiComv6c3WwxM8z4BhFTbSze7?= =?utf-8?q?Qa3JMNGlvAV5mc14jBxx27M8YYxkLfMW5w9d0bJicqmPIx1D2lJ5I9IpeGAgf3VTk?= =?utf-8?q?aX9iDJ1H78T8DbSBfGPaSYSqDWYL9pgVMKEk7IzbTuSWK0tLgzTr1OZZekb2IxHE8?= =?utf-8?q?OFwIjlxVVDjqHiMHxprURvPYtSwDaaa5Ji7rFLQQowmpy5zh3s+xflecFE56e3sNi?= =?utf-8?q?OD3Sf1Mj5MyyoHTuH8dXZLQb+y/ZxNkAGYmXHTpco4d1ksjIlGBhej4n3UnbTz1B2?= =?utf-8?q?4EPalErzSYeEc4iLZT3ZvHarRoSjSkR6TspHtMCKsG9rML4SkHfJmMYTgb5BePBh2?= =?utf-8?q?7k955VXe2kIrUXdpGyhf19DaSyFQirPgbidEXwBFlxpRIITejZolaki1MIKeb/AXM?= =?utf-8?q?pDlkKqzLDppcr6Cgyy6Fdl+q3PySlZXZVLRwPKqecmCmsZM+Q8uE6tNxRNr7/ETd1?= =?utf-8?q?h6fDuTN5uOoWAeuByw38J3hAa+Dn1s5y8tiXa0JC14gsT+/T+XdgzYkEdUvGkDucP?= =?utf-8?q?IhRK1O+MPjPSZMCNbC7jSd2i5Po8nuNdcEDBW04c0/JUHdaW44TvWbFgoOQwUjTyp?= =?utf-8?q?KN3jhJ5u3IC0KE31SrAbNUlZiulavl9sbtZT6UGxJ6Teo1BiNpVoLgw+buzkt5NQZ?= =?utf-8?q?KshkdvdD1+kV11JgaSUSKsoTCA5n6kAJXxMA2F/mMgptnFEx4Tnfps4ku7lLBdF8n?= =?utf-8?q?IsFVALLfMWQbH/ctp/Uno8VQkM1AaEVNGa1McKCntpvmtUoUmkdO2VmDeiodfVX2F?= =?utf-8?q?Y6yliLCQfYS6JwRSfUezQkG3pBqdvRAycsZtDxQ8ylF2q/KUAg3GfSD9XJNVef8W0?= =?utf-8?q?FFda2TM9+NNzmOG8t0JV65tZJfkZ6dTArMu3qZt5tWFQDG5QRUgV4V3A=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)(366007)(1800799015)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?ut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/KFvPZOdASpH326so?= =?utf-8?q?x5+oylfIMV/R+tfGiWr+N0C/KTeNF7o/tllOX7zh04ZUgdEnFBI603KYEgjmJXsbs?= =?utf-8?q?NV5lW4scceP+wD6/dCTcxSZWT8waA/U6yBEP+1VQPbkGZ7fI+IvmUapimJwwii0mN?= =?utf-8?q?/r8XgNtTf4tJ+2sRRjGpBc3rDnlmQWqCiVO2BdOWoBGzJdf9GEzRmasdn5wGEMeK0?= =?utf-8?q?nqnYnIOH+5auDXgvwwZUNoyGrnHO0awoUNSmv5FdC4JFecqQVWSyvRIqE7r1wplFD?= =?utf-8?q?TlgwPrbawLJ6VeLgXCAadnav5KuHAW/YMmg0UsA/XY6zSI2kXV4II0OdNGUrGB7OS?= =?utf-8?q?ODjX5GM6wlLf9EWTxLD5lTf0xEOgX8hTiFBlW87guARSgBCf4D9+lmtl4H2s1zIXe?= =?utf-8?q?BpBRHtLDy0clFTPf7ApHb8RtZ40IzRtKI6Zp1LgAK6WV5YSErr5vtUmEiP/HaLoJ0?= =?utf-8?q?MnZrDeS4jOaNzt8/eWCWdylTtkqDXaJXor1BC9uLdrFSkPY396RXfpar9LuVzOYnO?= =?utf-8?q?4ZcQjC3oLfyS2JfCvLkFMrMtoXB3c06dF9fkUarnicyG19mWBFhVIeRKfHl5HCGT2?= =?utf-8?q?04S/eoGXi2XAS74CO44kD90M0IHxPXxNqFbT9KLdqIj9btkvBFLQPHA61ryC+yhtO?= =?utf-8?q?BZ8pzmXye8wu?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1a3651a-3d30-46cc-ad5d-08dc69dd9fc2 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:57.0101 (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: D3oLRc6l+FkKfo79zh0DsHLNILeEjROEGdxGeEg0+nNZJ2mSCQbwMXmvOULDFDez2sxfMOKB3TAK1TIdpXdBYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 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 Wed May 1 12:56: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: 794575 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2040.outbound.protection.outlook.com [40.107.22.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7692212DD9F; Wed, 1 May 2024 12:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567998; cv=fail; b=s+fXQQVjjUJSKV0eGmW7W1R8BmHs5BLOEn79kvN6Jwvs/PzqBG/ZvarZy76T7McW+nx7SHL0KH5MYX5k7gpcKK1ShICcXDMeDzU2emyCfLVeLAWSxtx7AYylaJQr6gx/4hQ8MZepUIocuxS8MsEXU6UqEQSpa/N2B+Oo9+eHqsw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567998; c=relaxed/simple; bh=KV+m8eucvOGFTI4e8uJbFa77qPbZ1dpmI0MWVBfNKrU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=j7cZD5Ymia+U9w/zBzW+KDT4KCRkmwd/Vw75p2ES4qfJ5SFNBGpfp6Pa9VVG4QDpukzhXImkx3aQI3l/SzbwW0KzbDePXxP7V+copPlXHET+EpcbtbuVwBd3cvZqmgZO/YChvC37jLhXzUIbywWFe/mvnN8qhkLhyQSezUJEX3o= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=kzyBjaKe; arc=fail smtp.client-ip=40.107.22.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="kzyBjaKe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljZ0boUiuNpueqEYS1sx+4W9Zsj+2UcSUMJsh4j3b2isKHr2zFReu/hFMMQ04XlujmzxtascpO/U7CSRuLvNzU9X0iM2D30Z2VC7drjMCO3HDBjmtA1XlwxmHTCfSmerCPUfDLe572/F1i/J/rcVs6YcwtyDveg8oAB6sGrDhzgdA2UOObQsT/oMe4K66fuFhSViHUttgrRG1wzt3n4Qt2/0Yn2Ob2kv4cM0fT1wPJ9XQdTQ2yBI40f2q6Lxo2h52GiMhMX3WxGNfMxmLinhVsxxVJ5IzpkJeyxy25cP23Iq5vcdZ9Pp3zrxy39I8uAw4A0MDDZLwJtsAGarpRtyMQ== 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=ZOUGS2GhtJtBkQQNXEIQ7AVz3ycnjlDuNKMdQb91LlY=; b=gLJxpZScs2tF7a2nByZLypSwz0GAItiP1G5oawi0WrggoRMRqkQocGwW5w7W/l8g0CFdHk9ghNmOzP4pdrt3tQJ60UUWqI4WU9+5nIh0Et4tVHwT/g5UGwpuMJgd8Dja9WV1VOMqmmqgtA2TXyILVSoUnHlGDHbuJ4qZSsd+vkU+oks5arx8Z4AZriPqzhHtfy44VTMjKQuaJyqQkjB3cgxtUjFdCfIhkYuvhghBw5KvztwRl3iXm1XLRHndyo2PkG9HBpOklU3x9PBWOzdxeOSQcqg2dIOYuKB74/P6pN7Q8T/hiXwg+dYkT2cgJSy1+IXZVzFCT57LBTOcWRDtgA== 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=ZOUGS2GhtJtBkQQNXEIQ7AVz3ycnjlDuNKMdQb91LlY=; b=kzyBjaKeb+AUuC7Zjd64qxo43UGsk4EmPWahLi5mkfywRXN+mOo62iMeZxfFmnxn0uQJ5B/klABzN6+DNqxRx/Isq+Nk4R9xwGwU6oLUiNSdsUB7S/D7ziGL0pVHp+ZqBqCPHe8irEOBb/23VQSPHKi5yumhx09MPN70mkmaxyY= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:53: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.7519.031; Wed, 1 May 2024 12:53:13 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:16 +0800 Subject: [PATCH 18/21] pinctrl: freescale: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-18-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=8521; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=irbmvdeFvCZAi6uMcwD/z6mbAQPBAAsA8D6exICZ4Cw=; b=s3Pfcg/yFofine3MrQ4SLUV5kyRaLbAVfgtd4OqT6ZRRIpRty68qr71SYvc+CtO+bxloRInCc NFCqy3dfezPDcwGGN6ZwYHEtnT2HOVOUi16fBq6/QSfsbgPTLk9vd26 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: a797f85f-da26-48ff-4da8-08dc69dda962 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|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?lHjSlSLfGq+11kdaHWn+QHk4w/h89oI?= =?utf-8?q?WNdr9LnpmGlCtWX69zJymUMrpvunim+tiYuxdCmd7aYM73U2VV/L2osOrKlYKJ65r?= =?utf-8?q?Y1Mgjw1tdKcMd8VTZKVZKFXRViYzXmyAvapYzsIS+yGbD6SpGB7O9gBYrU8HxzdIx?= =?utf-8?q?OwQc7TZnHCm4od+r0QoClCtkQio9M+b3LIAoy3Xwox+ZQVV6dl49hvqg/hJzJW2SA?= =?utf-8?q?ckdgveGSWLOLISml/79bcfXYpCitScLvuhSAUxB9f32uzG9AZDgX558R1ZYNEWKJP?= =?utf-8?q?L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f-8?q?4x7f520oYrthZ6B2TA5aAcwDgWXGEZE7VU2HgvAgX9H0DOVMWd/8pcY89mrI9V9aD?= =?utf-8?q?ipxDGAemZHAAv2PtReRsllnpGoP/s8bhDUulGe2543V7fZ9vfM/eqL14v+rSFhMFd?= =?utf-8?q?Z1r4BrAj3BzZgX25IYR3qMwRx78AfTGQq/DoSr0fSLHx05Q87IsZrGj0=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)(366007)(1800799015)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?W3DWuDiClskqwek01EB5Wbn/BCpc?= =?utf-8?q?F1yTMShfCa6O0n1W5xLuiAfEEZEEq3u6HJBru3guG3//D8hOynIVPeilVDCmqSwKX?= =?utf-8?q?8yCzcjGDr6txtYyQgEAm0rs8TsT7XAm4WYiKI1GpieqwiblzGOl4hgc6AAW0ZmuJi?= =?utf-8?q?EtnENnyCASK5O00K7z/NW0W5nXkmuG1KltOaSfVQsGmZqz+qPTP8Yv/tMe/ipJBVH?= =?utf-8?q?b+Z8S5cYCMqjl12PA/L+s352tIpuDDQ4IezZmDuIRqXroTjQyW0j8TaZbyli5V1c9?= =?utf-8?q?O3pvsfOlgKC8OKn6l/Rf1w+ZzbMgDXLNlEuF7LKtPs8CZ4S+wacNfDhWwGIM4ZIox?= =?utf-8?q?/tRLpY9JZZ7Ka+dDq8J5Ut9z4TRXnYr65gB36IBYUP7CJWkToDXJfc8GZkNocb1rW?= =?utf-8?q?3MpNP+1wQT7TcfsLAILfXsbtwuVvbll1FgGVFcu5dbT3w2We59t9i0e7RO+Vs+NyA?= =?utf-8?q?HlZwwmG1igLDe9j2d9jpx/gZ8Ztp8nwbh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y1Gr4LsPvEO5yeMY+NUUiEIZOyELPMSyKp55s?= =?utf-8?q?sN10pXLODiHy2/ePN1PN+jEqzfOJ8D8B3Ah/TlLHrv9U6lss8Iuycqa3B7k7btC8l?= =?utf-8?q?mz1ImOQKh7XTirltVF2KG/lBAVZYoT1pJelRZDhJtcUDpafb9pXpyhI7PKgEqXZFy?= =?utf-8?q?SEVzVldn9Z4T?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a797f85f-da26-48ff-4da8-08dc69dda962 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:53:13.1224 (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: Epo3rPF9ea6ewaRMkGPpJm+PckatLqvHnIGPFP0/stFX3SZcV8pEmI6V6iT2qTsH2ITL/QfniVoTBL1izJRArA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-imx.c | 31 ++++++++------------------- drivers/pinctrl/freescale/pinctrl-imx1-core.c | 19 ++++++---------- drivers/pinctrl/freescale/pinctrl-mxs.c | 24 ++++++++------------- 3 files changed, 24 insertions(+), 50 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 2d3d80921c0d..cb129325bf24 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c @@ -63,7 +63,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, const struct imx_pinctrl_soc_info *info = ipctl->info; const struct group_desc *grp; struct pinctrl_map *new_map; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; struct imx_pin *pin; int map_num = 1; int i, j; @@ -105,7 +105,6 @@ static int imx_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++; @@ -580,7 +579,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 +603,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 +631,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; - } } } @@ -720,7 +708,7 @@ int imx_pinctrl_probe(struct platform_device *pdev, struct regmap_config config = { .name = "gpr" }; struct device_node *dev_np = pdev->dev.of_node; struct pinctrl_desc *imx_pinctrl_desc; - struct device_node *np; + struct device_node *np __free(device_node) = NULL; struct imx_pinctrl *ipctl; struct regmap *gpr; int ret, i; @@ -765,7 +753,6 @@ int imx_pinctrl_probe(struct platform_device *pdev, } ipctl->input_sel_base = of_iomap(np, 0); - of_node_put(np); if (!ipctl->input_sel_base) { dev_err(&pdev->dev, "iomuxc input select base address not found\n"); diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c index 90c696046b38..409efa1ce8f8 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c @@ -226,7 +226,7 @@ static int imx1_dt_node_to_map(struct pinctrl_dev *pctldev, const struct imx1_pinctrl_soc_info *info = ipctl->info; const struct imx1_pin_group *grp; struct pinctrl_map *new_map; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; int map_num = 1; int i, j; @@ -261,7 +261,6 @@ static int imx1_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++; @@ -508,7 +507,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 +529,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 +544,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 +552,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 +574,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..baa1e806688d 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -406,22 +406,22 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, { struct mxs_pinctrl_soc_data *soc = d->soc; struct device_node *np = pdev->dev.of_node; - struct device_node *child; + struct device_node *ch; struct mxs_function *f; const char *fn, *fnull = ""; int i = 0, idxf = 0, idxg = 0; int ret; u32 val; - child = of_get_next_child(np, NULL); - if (!child) { + ch = of_get_next_child(np, NULL); + if (!ch) { dev_err(&pdev->dev, "no group is defined\n"); return -ENOENT; } /* Count total functions and groups */ fn = fnull; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (is_mxs_gpio(child)) continue; soc->ngroups++; @@ -450,7 +450,7 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, /* Count groups for each function */ fn = fnull; f = &soc->functions[idxf]; - 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)) @@ -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 Wed May 1 12:56: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: 794032 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2049.outbound.protection.outlook.com [40.107.22.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41F8612A160; Wed, 1 May 2024 12:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568015; cv=fail; b=l8ziBWSNnQIZFa4sZ+6E9G0zRUDbzy9f0vYGJliqz4rcHamswdw/FaxcRRqqdEJBGkwFLQX4Smg2RpAgdT+GB0DyBWu0VZaZMrU4v5thDMgmUMVw8mPwmXtTUKHQwiHim594Rtx+ByPVkdGbmUqWlysZ1/5IWKJIp0BwxwFTYxU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568015; c=relaxed/simple; bh=o6F5l9CsoiURStmJJEE9Qa953QXfjAQBUVSJDbNbaG0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=GpuDvVDHaangwPXzLWde32Orjwe8UmYcw9Lbz9i0IvfwfWpmW8jNNgjak8SxvfDp2nFHZFUDD/650zz3atD1yWxO0kMyft79J24n97CDo/4wTWdIJKEUoDMIJXg2qXPFXrwO7d+ObF5nNzZMMeYf5TQjPDgej+v07gw9urH9yj0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=hYKP1dft; arc=fail smtp.client-ip=40.107.22.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="hYKP1dft" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyMrQIQxgXLORY8LgQ5cGpC7twhaNxkvD3iy5PLxMztUxxou0azI1OJnKW1iyrzBNk/cLawtOpfT8lECCoL5upFGQ3HwnyavPOGLvLa0fprUdKd9TilG9ElcANWu19ggXOCIPre+Ad33wohA7iVw/cHvIQOXq8swKz/JenNflHcgZLscvXZVwQjp9+rFlNd6yJhemvK0GHryctLSKZsfwcUa86E3w0FRLyMb2uS2p1yTsxx1bYgVjYsu3PPeizj3eX/fbiYTsloA6rUN/LM39NFEF9tYocvTP09sicy5uwpWNttuF8IIqXM3Px7Wv6q9JZrrvgPAdi/IN0b4DitF/A== 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=VVGTDZyj1RnAl01LIEHARrjBeQCzbPXdSqcc+xAEJvih9ssxrCmMTAGzrvl5fSzFoeIXN7bqNMQRMDkxsaJW6yLLv48C6zdL7R3gHjqSK1xPGBGmYADBhs4/r47mwAnGOYTkizyKE2baPQNIfm3wGBOxda/w/t4H+3jxy8qLUHrm0unBWZKpfUGNe785lB7URe2BvDgV04Q1JT36dWv98bil2RiMYptLeGpXI239htCSfAd8JjHC0BUiHwcq00RtL1ABPBPqcwlBmCGFSYRql/KGBbLfRmHhDxvgn+55viKLPDZmq3WghXJdn9euYvr3ZK0WHhloGd1Uprkk42O6pg== 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=hYKP1dftAW2q5LqCOyS2XVjSGY/jHgc1uYQGjzMPqbIQvIKeUz+umDZ6TIdK30LOv92UH+K5CPMIij1gC1YSMZzZftVJfMwhzQhxAJ2Hv/4koEwPM4yWJ0fEfRlzYMWUYW5ANVHxX3Fpss5iUkQ7funftKAYLi4MN0da0FdGQOc= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:53: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.7519.031; Wed, 1 May 2024 12:53:29 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:17 +0800 Subject: [PATCH 19/21] pinctrl: bcm: bcm63xx: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-19-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=1176; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ngb8bjYWoY2vP8GroJ6WPcYXu1rPDt13jwjXmDP0P84=; b=inAIaru0WMRLGzM3hLBhV+swvKEs0M2rx4eFAsHRDsmzb0LTjRVPF2wrCwtv0nZ378wxJlsEK ubzlBlL/0H8DPj4CCn28aHMnunMnRVB/96akcAo3TUmqc+aFkdavPMN X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: 28a73565-6187-4894-ea9d-08dc69ddb2ef 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|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?2p3GfptMK2wWdp2BalQjcTnQTSC+hIy?= =?utf-8?q?knaFNr1OA3YHYa4ZQ09Bt/4XZ5ME/9m0HbS0vaZmSQKQY41R5unJumBx9g2uEyGKb?= =?utf-8?q?UXd5bCggr1rAZi3V55His1edpaKfJNXMtAVbcRnuRhh0O6gdvho0130UyskIxTkJG?= =?utf-8?q?h4gK7R5lyVx4zeBwZnhqk0f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UB+DIG9+6NyaCkBz2z9HjreQQt1b?= =?utf-8?q?44iFsrLLWmW8wCaVYFBwZWd5/Vrxi4uiZX/jMHi9hk4pbb5aAMPIiw0sOhs1bWc2H?= =?utf-8?q?+QWLD1FWAh9mEYatxLMpsIGNpiMfJ2PT/uBQOLDBQINdoIeoVD3N1uZjD2sgytOWB?= =?utf-8?q?5zyZNW/jl3PUEoztbJBBVq5R0aXSVaqIwJrx8uYu5bqmI6bqpHnAgm7btkMkwTdtR?= =?utf-8?q?Ep9MCOkKUrWgO4xe3KkIcQCevrgmmy86yyQ=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)(366007)(1800799015)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8R4h/UaB0zMmC5LoWdPnOL9aqi5g?= =?utf-8?q?0Xhp4uOendG0PU6W9lGWz4JUAwE276yJKtO/juFotrS2uK6vHIWrFeQPeG1XBUMdq?= =?utf-8?q?zLa9K1t3bE0ICdxTWsalD6u1yT9YJu51FRTAKXTfrPOCYAp2A+L5HGaFvwPdcAY02?= =?utf-8?q?qp6vOs9rGN8ZIi/jpbr3LiuHjQFn1Xi9b1uCGh8/62Iv/i8bkZd/MVOZVK/Ns6z5m?= =?utf-8?q?dl8iYzpKr4jhXdGqahSYZEMBjv0NjrwWD+AuF7y61xfi2+0TDnv4ecjRAJvBAuPmB?= =?utf-8?q?oWqN20v9dflcUmXsJygOyNjzkOW/Vcp+2r6ZT6ZKt120B978oK0OxWxI+1hGjMScO?= =?utf-8?q?M2QM5ePE4vuBxPCPf9FsjJHNQzPBGHPN7rn1DfXVv7706Lc6lA9rb9CmKCVkUJQDe?= =?utf-8?q?YhIs9A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JWHgUTzLtA6ZzfBqTu+3xeJZyM9JH5UFNCvuX?= =?utf-8?q?iGGEg7urmo4sZK8uffMRCrBmjekF5HjiznvNFM2/DowByO0X2Fn/z0jADO4aN9vAc?= =?utf-8?q?baplomWX7fGCXBHHjEpmBOBJ4eY39XoY+7qNcwq0ztqFrk1lAghIaX5poZjkOmFhu?= =?utf-8?q?Yct/u+DTLibzNAUqP20XDjjXPAmkQfpdGDGZ2rf1Jn3lECK8e3udktDahcjUvbrWL?= =?utf-8?q?BFWTTYuTtzap?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28a73565-6187-4894-ea9d-08dc69ddb2ef 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:53:29.1802 (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: JtileGvMyRwe/6xhoIjtJrWVNFuE1tUQoTyK5MqWQGRWwp0HDMa5VgyQZnuVjiYwP9Invnaufxd7mBeXn4Gxqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 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 Wed May 1 12:56: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: 794574 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2082.outbound.protection.outlook.com [40.107.8.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76FFD12BEAB; Wed, 1 May 2024 12:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568030; cv=fail; b=p2GzLWLvo5oCwI/hg+F1TXN2EaQDWH1uZii22Himd9Lz9qG+iWsQD3e9V9qkv6OAurGKUbcGsCgNpRvrxMw00A06XvPRQ24w+0cNUQqm8g9f0Gw8SBoBrc5c/gZtx2Y6Kk1AWe70SD9qotOA8uhhQilvqUfmr0RSbur3mrh9rbI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568030; c=relaxed/simple; bh=bSa1Qkf14OuNaO5RzY4Gu3WlPihsAEm1/Tvc41VbvDI=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=q/YJMqRQtiEH8nON6vYqvUxMwhTBSsdlbA6QRtiXX/LeCh2GkEMa0+aVngkq3H30mZ48Hcae+rxyciUQ07ewgWhdBeOm7kSg72+Thlgzv7jYO46W/juj+2ovjaoU8WufIUhZGV3iD5jmxBFuLUMO/wz3rB5q01m6IAUClANEtak= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=K2kLC9l5; arc=fail smtp.client-ip=40.107.8.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="K2kLC9l5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BrKJRJhrAXXi4i/+hJ1j9UdpHP6FNcrQn0czFC9LXFQmQ1uSkEB7GR3LWWmZMgGTG9LkBvN7vksBwqUi1t/QTes918QjXcjCE/6cRCeAYzaTCZSxDkNRcGzUuD/qXqqFXP9hr5uxDO2qZS7mZ7mx0v94SZjtryETWDNSr2AG42069jK+x8HFnhgd8U7osV0ZGPdeTUeHxj78Z8DavGulcyaYMngCb4BcJ23r1+dR5pkUa9DPphAqku6QxRiBqQTuqrkPzawnpi9lUuPtqvv7mRQKnHrAaJqwkrWExgVJxUBAWpPnvHfFRoV2I3W3u5DC7Kr97vXliWw/mc/CuVcLlQ== 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=R/HN0uRuWCWJNe64LQrS5DariOLht/eVTftGm18bK78=; b=l6RwEFZACPoVhJluOHFVBI7404cwKjbhdcTkQfV7s+pXF2DvE0zDcVrPbV7STu+icsFCwieWq7YY3327y8n5uESrBn11x6r0r0eA2C2fHn+x8leJHCLWWhQnWcsrS9U+nMBoW/7mrxO3PKu7NCngvfa9KjLorlxmgzeU/qckET+J+VjrtjxWY5+H1Mq7nUNfAMuNmIC5/HQ0Hm4MV3EKcIMZ/KxG5ie2JD1eJexyLfNFp4kpqO4yzY1Zunvv8rkG9MRXONWdLaZleOENz4H7qKalMYyuIdf1r/hVjxWOrt0qdc5pZdjZxgFE5rhzrsb5NavX5aozKi3DI7qmjB2wtQ== 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=R/HN0uRuWCWJNe64LQrS5DariOLht/eVTftGm18bK78=; b=K2kLC9l5lAUrG/78F6bbfqzg4obvd9TrGhg4Nx1bTHYElLOBWA7zy41Lor9jbtQ6E3G83iXxQ8YpoojMX3umsHMeZ4p9PVVKqDUCurBTX9NXcLIdMk1nwHUcnl5rhDhNsuSs4WQQh1lDQSshFtTxAlIzsBmTJfu0u9Vt4XXiMVs= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:53:45 +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:53:45 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:18 +0800 Subject: [PATCH 20/21] pinctrl: aspeed: g5: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-20-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=1515; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=h0a9LV3oYSEF4ccWiOP3By2vye9Q4bNslLUZUu2GcUk=; b=SXVAnIHFcdSsBSSywnFDOPtR6P41Bx05UTk5YENmkF0qjYhIsrg7zH8yQPwm7asnMsPxjxU9Q 2b97znrgTqNAgUnmN2vMF5Tp2B1upQ99/QV5V2XBdTEDCoOEv2AncJh X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: 2309f409-67c7-41f7-b48a-08dc69ddbc82 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|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+hqAZ0HoGwY/WdrbOpLQQ/oh5PvnSmt?= =?utf-8?q?rEKQm66X0rS7ZC/1nbs/FzXHn5u13O4WzJ9ivk2AY7uRGgueBBgs1Frlhl1WinUko?= =?utf-8?q?IXxOxq4ygR7uoBq8T42toBJ/chQK3UIt6WMYsKRtqgU8PY9sijwnap5T+EEPATDEb?= =?utf-8?q?kTGH2piaYiLN93AVJ64bfJ/nBaYpXlLS160B38Hy4Cc/1zxcQpkk5zv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O1h8WK6W?= =?utf-8?q?Z2lpH2MnCUfWjERkKRuZTfdSVm0plJKhT8GhH5E1y3Q+wPgYHqf5xYwSj8F9Lp2IH?= =?utf-8?q?eNFCPTNmyv8I6+diLJQBLMxxqXfYsfHzgvQgW4YtzVzSWFEDckRshXHMAB8/XKf3A?= =?utf-8?q?wOzSPwAwkc01g0DyZZ4byp8ZLDBE4BmxZDJE4a85/g1IbNFyOr3llKZ5FH0bdgMyk?= =?utf-8?q?DLXV2snzUaGXVRF/+rJTsEGHqdtKPsXsuXIpL38Xv98n/eFhraku9fPs=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)(366007)(1800799015)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?t0703+/aWSCO/2wCrXB0fYRVZgkt?= =?utf-8?q?By5CMHHy21zvE12ywNeGWizZeKtM/FY0/XFn9ki1FRDhNS7NVyCkqCLw9uYs/AeA4?= =?utf-8?q?MQEPuzNbUgjxM0X6TPKu2azih9RVWipRRecN7arOe5dnvqsFLqAvQbf8K/9rvkCjq?= =?utf-8?q?frc7DMppagi7rdYP+vNfDwvXqZlDv8/tqio26UYelRxCac3ngrSSRbEtsyE4iScm9?= =?utf-8?q?KFlxCzcOYScQBZaI2UkjXDL8zNQ9oOM7n6Nb+/xYqJpUxu0XL8SBUoKupglY5JFXJ?= =?utf-8?q?C0A5mUWg4fcSonrhJly/af/YK+MLIHwf/2tKMyEOQZmYUklsInBJEPEsBo0XxDQx9?= =?utf-8?q?7MIgpcw/HYv26z36SaVDXzEsS8eDQUvdW+2utnXxgWLPuSdQ5zBTXOcAmyA6YL+Ku?= =?utf-8?q?5wAd1GDE8vWfLADf9c/9A573u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A47uDrAe5YuQ5jTSt2aU/iEs30K1lqqk51?= =?utf-8?q?dD6+Bz5DqLr6lCe0ME1z9hm4KhNWP+xUON5t3QUvX2viL4q5e9QEYW75L/jzOw4zZ?= =?utf-8?q?beLazlZyDZvK6sTd4yxF6Z8ebDKFt2ZwOHkkPFGpLG9tm0VZXOxFdjxPtRJjg4nSO?= =?utf-8?q?9N6arAOXfsttCz1OggCNo0sZGBt7dChzJelldPiaNwUR/aaFlf+XrJmSr/hXbAjZa?= =?utf-8?q?+tYu/cqgQHtJ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2309f409-67c7-41f7-b48a-08dc69ddbc82 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:53:45.2588 (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: c7Hq6vl1hoEdKBQfGyXFYIZ+fqMoLhYMh1DhSQi9POJ/KCDU7AREbfyGyyrtUObiPRdCGCkfUxBwOXpIskS6rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c index 5bb8fd0d1e41..61fbfddb5938 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c @@ -2629,14 +2629,13 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx, return ctx->maps[ip]; if (ip == ASPEED_IP_GFX) { - struct device_node *node; + struct device_node *node __free(device_node) = NULL; struct regmap *map; node = of_parse_phandle(ctx->dev->of_node, "aspeed,external-nodes", 0); if (node) { map = syscon_node_to_regmap(node); - of_node_put(node); if (IS_ERR(map)) return map; } else @@ -2648,7 +2647,7 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx, } if (ip == ASPEED_IP_LPC) { - struct device_node *np; + struct device_node *np __free(device_node) = NULL; struct regmap *map; np = of_parse_phandle(ctx->dev->of_node, @@ -2660,7 +2659,6 @@ static struct regmap *aspeed_g5_acquire_regmap(struct aspeed_pinmux_data *ctx, return ERR_PTR(-ENODEV); map = syscon_node_to_regmap(np->parent); - of_node_put(np); if (IS_ERR(map)) return map; } else From patchwork Wed May 1 12:56:19 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: 794031 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A132612BEA0; Wed, 1 May 2024 12:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568046; cv=fail; b=E8JswDB0VRuSKY3Zsn8+2EA1J+qrmx/KdoIUx5YOIkTDAW6AFnTjR6DT7y5E3O0n8/dJAgxWqU7UNbmUaG90PIIea4jt1fCo31/7FEOgnXL5n8uoEyplwhkQ6TvPSFbEBLTEKL/bShjPC2D5mMP1/v//JwM9iMsM2MZ/iMFAFNQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568046; c=relaxed/simple; bh=Hg4Xy0vEppWnC63RFatzWPhpn/VvXfklWFuoj2CIg+Y=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=fzaDGuXu3gx21rc8RIV1SPUvAM7AebfW+SYKeC4VkQIy8nENyI2g3OpX1GU2DHbCdmvFrqfjEZVRBp4wJlWS9odRlNqDXCLbLXU9TR6UOAu7CAp6udnhUdZtDRpH1qHk96t/WqGvd3vdXdJ7TmDCk79MR7zPphLxplQeWb9WJdg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=JDJ3tJKS; arc=fail smtp.client-ip=40.107.22.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="JDJ3tJKS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aalf/pOql47GT5ltrEi1+Eny9g+kb6hmT4tgQ3lLG1eBdZTBkY2/+o+z5AmkllwxQZkAkAM4QzrIfg4oWz1ZvJWbdJMUNb5x0EkWXaIof5GJv1y1f+TYeshPXd6qE1rvSj/wY9BxqL+Korsvn1eQTMSC3LAdpIUtt/RRZzD5IfoYhTuK+T3VX7u7onYrp8OtLGHgQefcxQf2i/nzDu2ifabuTssTAGBBOT8jkOwaDW9ZiPQvsz+eJeu7PeS8pgXlyzMP/dXNQsNMCUtPxfq4n2f/AZIG5Yi7U10T7izh1ufjQb2Nc9/IxpsfVNKd4Jnl1yUST9hdvi9y2iSf4VSHOA== 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=oTYVIYaIEia1c6xCx3wSRZ/wvLbfzd1nWwUxdeqcuLBx+Si17fPfRyuLz+t64RXW8czpyAhdDHXACBie25R+cnJwBaCj/sf4f1gETDuNOg1sE9ppmTtTXAeqpIDsPIjOlQZjkM5o/ehbNJCUjhhMx/EgpOby5mNi7bk5l+kzaHxIF6RoC2vRZ6xWzDglw07z4JL1or/NK8ZbWOHuge2Zefg+jMsYQYyCH6sPSaWNKx/SSInjhUx+anoEFomB/nRGcYvm1FmmhG5c9Ks85NOmCfBlPPKjdu3eJVMd4HLPDh6BTAOqd9I+kHp/Pubc3hONpw/85JM4Yd8Be9VK0LObrw== 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=JDJ3tJKSv7ITKll9IdzYp8RkMp2A4rMq5J2SRZQVUMx5todwNBrKZOGjRm34HacIKopamUcIppjn9B8DkzdS6OQ4K7mRk8xaS3kLlEdvNlfawGVRviSIqa6hgzA6AnmLFPpTqWJElR1EQWnSv2HJ+MbR9Qh0O6cWbaEWFnX689k= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:54:01 +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:54:01 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:19 +0800 Subject: [PATCH 21/21] pinctrl: pinconf-generic: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-21-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=1107; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=2wM6S75hkeICu8KMVBGWw7nINzfNCEUbOtGveeJZglQ=; b=Fst3hl45iGHgFaoTiJF+h16Ucdgm/tZpALLXVlVt5L+nhkjqsyRRvNK9ZdG7OKgMxyr0zBvOm dFZohN5Zm5QAMChdlPzaw9SqDpw6GAaAdpZSobM0eKkl3aXOvSnJAOJ X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: aa011eb6-b045-4e93-0830-08dc69ddc61b 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|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?TZj4dfMdmSyFxJi6MD9l3ImLrF94+Pp?= =?utf-8?q?4LhBaU395+//d1za9LGJl9yCbkd5EeKlb6w5MdTXauETPBqhmkI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r383a+ag?= =?utf-8?q?hIrDJqLQjBHRjv+WuD/7q4Wbvk8E0GWDqdcZKLiISxefE7uLKKd5gwaZKlUHXuSY6?= =?utf-8?q?AooO0H6ktdSXgozMRvsDs5QSJnMxQ60vN8GQTF4PXbUI+4iT1vtXac2kAUUU4ynG/?= =?utf-8?q?ot/IpmeoF1rJLOw8ye3rtP+vLPl4rJtCshOfWZxTvF4JdsmrA16HS+TdEAKUF28sf?= =?utf-8?q?czPNFiT+N3iAP9RJZrIRSdUmdkLK97+2DhRWWcRt/3o300wCjSrxIaxDYPPAFL8zY?= =?utf-8?q?J6IGomis2fJ0GsthrJ4hcuDkAbbaBSJ4pqM0O6UqMoy07z84gMcJQ0Q95IbFe7/Uf?= =?utf-8?q?/R5pEFzNdiOeG+Pry6wDFh7R+aqHLm34ueiBA+hALoXYKGBdcR2huZDU=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)(366007)(1800799015)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KyB2kq6YICywTvdpLJDIYPgDwI7q?= =?utf-8?q?1DXy7xSQRigHl34Y5oAVZWwiF4snnr7Z0hyDhI9extPHgBhQWbj+FzdcC8w4Os/0W?= =?utf-8?q?EvJ/Zlnti1Ad72MYvVrKWVcQ4KZ5HCgrzZo2jUkQUTYY2zJLyNCCrx3WX3HhCNAZF?= =?utf-8?q?zgNsxWRTUPRDvYFtWLhIVWe2gthCWgoVszboPHOeXAhRaTvHoaYfo29/7hZr0BxYc?= =?utf-8?q?g0tdQB6Kf1FaOuUlUleSNNQJYF+8MEEdbci+rDK7s5SiK/NMtWplTyz2JMnVSJCjO?= =?utf-8?q?A6gi5MGMYlU/HA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KCqMj+GAH7/u9dEmhMN6CN4lxWoz4wmZIe+S6wvIL0gd0fU+ZaUI?= =?utf-8?q?DN93yQTLaUlDYSfSK6aabXBNpvFQW/DLXtvJBajJ9DwISMYImwJTTxNVwfoc+yWSE?= =?utf-8?q?E+g6KImFFknzZ9RU4Ws9lOo7dNzy2eznBXFldjSdwn47OKtJ6Q8tMH2UM4afe/jnM?= =?utf-8?q?JwbQQe/Ti/eu6ONbrPYhCpo7thjHeePe+uVI0bukoKaua8vd8tK8Vzc+lu6SbpR4E?= =?utf-8?q?RR67hhnnYnppohRvUX78Y5gQp3eoThuAx8pi32Z0Ndh4vP8qBEnsj75GW/6MZOCeZ?= =?utf-8?q?5gOrbrypJ8BlT90Ed++KKnU2R1mBAyV0ms0QyVZv2XMeH+WDynSYROEgMVxQL9XNC?= =?utf-8?q?r4Ol96pd4sJ2?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa011eb6-b045-4e93-0830-08dc69ddc61b 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:54:01.3195 (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: IIlETgYicOXhlsUoUZ/2k7SDvKOTmE/R5jtZBOI7DzknFcGm9/UrdoPMVjPu0KuJaiNr1Qn21skLWVl6yPQcCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 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;