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: 793870 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-gpio@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?+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IP: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+8niF3bLO6r7BJHV4OZXKxMejGLglHdomc0u3CH7NuapAgCT8dfYwEXI2dPwgyp?= =?utf-8?q?GKKK708mlZxDUs13WNitYHVYEQpqSR9p41E/OC/Gzg9AmpYOwoWk/RGZjKD/NCueS?= =?utf-8?q?7qRbBYGlRNK3vo03qxvb58ght2JV916ElefQHm8BdrMcJKL11S2DNNl90ZgUb4WoH?= =?utf-8?q?7o2RsQg8x2mMFZzfzRvRQBwMO8jy0lJqqaH8KpVHVgOUlqDBgt707c4dXUOkZphG6?= =?utf-8?q?YWejMrKdf1HoGIGtGvHUFKsLEbLL8l4f7+KII22smrLDgig7+jc4/m7HrzOqHgU77?= =?utf-8?q?OcXi4qX1K5Sj8bsU2W7UAa8gDIfVkxTkqKD88l7y5sDMJGSpAsjqaPVxGJPgXsDID?= =?utf-8?q?yqOQr+7D93ulARbljTM3MOmB9kDVewiwYKcTPSg/+h3EUxGE29POnzaxbwXdjRnVZ?= =?utf-8?q?5vj2rfZqJE3NbrKqREd9yOa7cpPvSb141QhtApwr29Aiw/blOiELI98l+eeFPPif7?= =?utf-8?q?uzucicPQD8TwKh8fuuXzuDmzuXcmrqBWBJpBPg02bVz63p643Tx57JLpp5CtM7g7l?= =?utf-8?q?HdLvBFSMU0TJWQPXWFlu08pAK1l9bM4+TxoBfrmddTryLOAXcy1syLeDrtGKCvmjJ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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: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: 793869 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-gpio@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/6plSGIdTOO7WsuWaWUyrujQSoDk891k6U7EIthAYRjl?= =?utf-8?q?fut5gL/pxiO2u+J9zzzt/0qlF++D7xporJbaWnVH1pSb5pfvF/dedCm8U21tAr3aB?= =?utf-8?q?8+KHpoHVvA08oq/rHsGTn8PeAsAJ8TwA2jwCtdzEKwEtnv+4cALHRqppuLInQGx4o?= =?utf-8?q?LdBR9bWiWBhD6ZuR5Z+4DVgWNsTQJ0vLgwkXFCCmyPwNFc55ZD7xIbFsjUrTP6Iya?= =?utf-8?q?1nYevhz1+MEmp/PtXL7qODtewgeENYVeKiYtsH27viKvkbOZrx5NiLtE2DMEEfSea?= =?utf-8?q?C+ikyNdBZkfzcH+n3s3HLEOdn9MP5gbH1xXzTgiZfl9a9TYV0F/dks26iuWnJa+u3?= =?utf-8?q?yNhoUnJB6vnzDd4Cr6/9PwnyUAek88Zdu7d7uKdFKbsK7Y/pf70P5HtYSRtIGJgbm?= =?utf-8?q?+SJyX51lsAeY8oR2/mW1vp1TGEb5oL9ucv9Ypg9Jtbbdeh+rDb6dtvrsm+MjsnrYX?= =?utf-8?q?NJdjKlGbwfv1EKTfa3akgIcNu0N3Cb4UKkOCfHs8Y3huujjgNd4I1a7N1AB/Z6klF?= =?utf-8?q?mJiHyEgWCK8oNnsdIRXrFrMBPtvkM/XftwXpfWlM+L9dwF6wBAD4I1wR6M4PQxaYu?= =?utf-8?q?CIPGz0/ZBFYnLnlFrHdRs8+X6CvHtiYmvZd3KW/DG9EQWwrJz0HNvXtqWXftoqNob?= =?utf-8?q?IH4fF4roRfdVAyG6Hk4SG5zMnu5M/QrUoli4IIiSADvzTIks2HAQMycfatbdLaj5E?= =?utf-8?q?P6gIg51Kpau8Vd9Rs2AXxSIVDFJFqPKy1fcDtdBMzhMmdbmf3achJc5/y2hUtPipY?= =?utf-8?q?tLotInK2ZY7ppKzQHujEPvJVbntAGWpxm1IImL4sa9cGNcTPttWSaUzyM9V3xsT97?= =?utf-8?q?zXh9+uW9yE0Dps491VQ5NJsSubR2fe9hSZds84c5tjGkPjmbhEYQzSXhr/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/NETAq0pFb8672wRj1noCtV5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uU/8Qk7RU?= =?utf-8?q?crMv8LID2nQLv24pwP26X76/RR+EzaB65nEFycH5JBORefdTjPnxOZLz2LansCy0Y?= =?utf-8?q?Ym789OD31XnIyg8wX3Tv/Av6tW/Oi7/d9aAtSeLav77br104NFet9mZ3uK0nhCd98?= =?utf-8?q?6+rY+2VePT+4BSTw275Mzrh7FEqx/c4Y/bUcf8m1lFZCqAJuvrrlMqXo2WbTl3HWB?= =?utf-8?q?WTFofgOhKbzNVxtWyP2+NEfcckuzLcv8mNwsYaOYnBVaNznfiQ1fbbfqugTvUAwVA?= =?utf-8?q?zTTjywoqmO11FuemPBLSMn/Fut8YR+3dUhh/XXaLtqToIh/HbZ6X3X3XWSLmPbxX9?= =?utf-8?q?OkmXlQi20AfoAqCHKnSRcffBm98G/SolC2p8o7Pw0UARUlVNeyqomZ7v+9xo+YVv0?= =?utf-8?q?vcfV50N4r03HVn/3fMIDrcGzHB3Lv5mpEAXNGubTnQIXnwBthbqUnNSW26EE2r3dB?= =?utf-8?q?OQn0swugUaaQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c222aae5-b13c-4c9e-3bfc-08dc69dd22b9 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:49:27.2054 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gYhhvpfni11AYjiQmPbJI7VN9cJiU/58D8H2Bm9JL6Fv8mo+F82kEz2zeToWO4luMT6owRB/C7fRHw0IinuiLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 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: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: 793868 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-gpio@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-Exchange-AntiSpam-MessageData-0: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rdCE5vyJ1ik5Sm7+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: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: 793867 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-gpio@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?CT0wvk1n5Sz01TtbfRkFcQqgnotl7PytZ5N4Lxbk0EjWrkjfXgE9hmP1A0igZ/JgN?= =?utf-8?q?P2o7J5K/b8TgOMwN4IT2kmhmtlTxOTrEETkRTJenKG65VAyFEVaQUTeqsptLRJ5VF?= =?utf-8?q?cfCQoIMyU4wH9A3arSq9uJUkj/0nztVj+fsdOojwt/83AVQfbQUYfWfJuKtCfpkTu?= =?utf-8?q?si6So/pSStG73Y4HID5u5U9Jzj23gesavNw3EJy/tTuX5gSO2I+ZMxyE1g7IHOQEu?= =?utf-8?q?4OS+CPPTNbt8ld2nv5lq3pNpUDTgeog8RBBtzCSeWkOZNjvuGIS7EOXUXb2lXVm/F?= =?utf-8?q?zibwkbN6+vnlzj7jnMxxAusiufU5ddPzhG81bdn8wqoM9Km/MDS+v83yDwI6YkdDF?= =?utf-8?q?yDgA+Q0g820vyZqvKx9p/UlydnZn5Jk7XtuPQP/aM1Wt8ZYIBksK6rUZea0G/ukQL?= =?utf-8?q?0allPmuhgM2f8XKksnDjEPl5VWauV9F/rTfkl9Hh6jxxgM8+H16ijdVsTIH79gTtl?= =?utf-8?q?/1e76sR1PaH3yULR9/3+7lt9MIAYBnVzrcZcTGW9TSoWNR4xpXmVSdIgv6pHt5pTE?= =?utf-8?q?b4XavspGNVVjs06TXDQfwXAFf1GYEygrUx1Tf8K4AJms+U2e5F+UpEFlOM7Z5mgnB?= =?utf-8?q?ZX/hwEaMJaRSdh4nGeL9hh2QV0qCxpFc4+SIFBZg74/C0N/p1+G/BswnTDD8MATde?= =?utf-8?q?ASEb62fHBu/oeAI+qBQTA2Xatx3FARXJ6fuWCEHJz39gG23RDB0q6kIPisNV2fDyl?= =?utf-8?q?qAbG1ALeqlGnIBu0rLE5AKuqlqK8ftnasOtvipEdZvtigbHkSNodo9hq7MQ2HRdWn?= =?utf-8?q?mP+SGtWOaZ8Xkgv81PG7PFpzGmaW14gLcjtSlojBzdfCNdPmZmYTSuEspRPjCykXx?= =?utf-8?q?4Wl5DAtltiOuu8F/xKRrNPg3e17qDPfYx9N65zB3Cm7NDsseR1hsaCcE=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?a2mBAUZ8oq5ebuK4S5WpyLXBcGytgSxfuUzmwXZqUHJr6ssGQJD8s0xs3PBcFkvdG?= =?utf-8?q?57y8RkjUXjSGzs74nTb/1AhOJo6QkGLFcma9G6R3b5nF6VXXbI56Q2D9FVACGvfrF?= =?utf-8?q?P7jjx9W9D/0NugNXAOX7sZfZcdWSAx7bazgQGObrMhstTjRdH19xGd8poWLLKjlhw?= =?utf-8?q?0TnabVoKv2ezIFkhudCMN9PUv3CkehrYtJyYsfd4nM92odHtjjiZ4UpPbjztn1QVM?= =?utf-8?q?hElt97hwbfquWMHEySFsnVl7NBv1WrkGLEsC6H54lhZaEK28xCEwx5ww68bQksQv9?= =?utf-8?q?DoFLiXpOr5r83SDb6KNoMTxHJiVLr8dird2DQcrCdQIv991fgJ1WBYTKrA4opOPch?= =?utf-8?q?bhcFER6oXhJd5DGiAe5Cro1FlMfa0NUux87QIEBm7jAZbBde8wVh8U43Gu0rFR+4k?= =?utf-8?q?WVlj83mn6rxfKDbXOxBdAZH0SBWoqwvG2hV3qRH8W/Z1NYJSsB+tGm+p5WLz0XxJO?= =?utf-8?q?hZ54iGDUH3N3PYbM3vt1y4xCP7hXmEWqWW/IoIQVk93eyYB4D7BznMnp476k5wC4O?= =?utf-8?q?uiotzl6PnamZ0ZCUfaZ+gLpzrRI4hunIEY6M7RsclKX5OCgHZVyiSZQMvoENw7luC?= =?utf-8?q?Pu3PHd5fqGjFJCXOu1rUbsIZ0qp1NVywgrkuAgzHn83M0uqU+IIg8bhZ1AgA483b4?= =?utf-8?q?JMhCfsXAEuwXeSs34xL87QFDpH2FfuAUtMJ+ICjrOyjrkkvLCVgljk8zIpAvZXdlI?= =?utf-8?q?oz2+f6+X1Apmhbrg+Ah00SkJVMMyvr3FrK5nxdrmD9cz4F1ZXOPifTKWCvWk/WYOL?= =?utf-8?q?/QFOdB1nM7Y0tGCo7lNQjrxpGAD7LwsytfvlFRrfW3mUi0a+5b723jqHc/Osx0qg3?= =?utf-8?q?zIxztFOL9Cr/?= 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: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: 793866 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-gpio@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?EWEpK9vzaKseIr89ngn/WSTOs4qvC4zq4XqzXnltbndUYRTKRXTHaqfwh0JoK2Luc?= =?utf-8?q?TNmTISJaIFcvPOhRQcIo/VIiBGAhstxQz8NyqFFewfXrk6ulVdsspWzlCYQGTS0b5?= =?utf-8?q?Z4jnfYowCs86q2NeSnMsBXkS1X4gswJdayVHrRqsV327udNA7dtJe5/T3bF+p+bXL?= =?utf-8?q?dtFD/8GsAPEPyYvt80gnoxWPrzbehS4l5e6C6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; 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?DUWWHCBI80eLVaKpuOG+6enpLQS9QeBR4H58fmDPXNPPJnyLqsz7fY/3AYdNyunNz?= =?utf-8?q?OsNIfDQCaVaozXK1/NwP2ppihXQuZNXsR69ZcLuupbRhGwMgx6EoCmkwkuqWdNXz+?= =?utf-8?q?EsTy2mA7qpRxt6sc7j/Zx451Jzu/QemucB6cjMyl9k44neqA9r6jjJrILkjDxuU5a?= =?utf-8?q?hqQHsPr/nBb8KgQMdZZR6XOyPFZGpxjXogsc023jmEOTJ4xgg73+Vt8tFRO0gNl8U?= =?utf-8?q?JDCyZx/QdnnRTmALNJLZvYj8xYJneVBuZBVBiTjjVpTspoCztl+hZkXqEbtUb358c?= =?utf-8?q?tkTFRI90bk1cZL5NcaWujLh/kZN5M44afXSRn1Xb/30sWy+AoprqnrepYkZgev3xO?= =?utf-8?q?QnUGmqE/k0hVG1vbNPof8fv7UQ4+92/yOStZw3j4YwQXdIV6Mgtzc8RvdTYPuGRig?= =?utf-8?q?mK8+dcQguZGt5Kft+F2Bjem62Zgf9zjcs5QXR15ocfUDi6aWh5mTuRgQWVbB5tDlY?= =?utf-8?q?exK4Dii+SqRly4WFFasD1wp+kM0ZIWd9/8s8dpUWLwaG7l2z14xJ7sWqcomJv+AO9?= =?utf-8?q?T0bf4nYmqLyQVqMCpFpq6EIrAo6VOWZ6TCoNRH5oMa1W65X58CTGUHi08KZ1BekRq?= =?utf-8?q?wo4U0qfdflIOM191Aeje2uSzUJIXrb90liTqKvMJA+Y5KHzPWKFdW+OuOI/pvx1Z+?= =?utf-8?q?UGw7X/or+yVEl5vINb8gGYzsvyb1DepmFgDbjaYoGrGv5QkZy1G9J6HlYefXMhFPi?= =?utf-8?q?5cgT/QsWVGK7kKWLSLddbb9rZv5qDLPOVv33LQIBUesoOzWj6mdkJLKdkFeQFl1zx?= =?utf-8?q?3xPOfUMPastvexDBJDEJeNmBZcP2wH5zTyhD0DUu/GZ7dJr6xcDBQPf2uqDcEwo4A?= =?utf-8?q?YYYlFHFDsj8dfzjjhYRbicPltkmneiJ+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: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: 793865 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-gpio@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/xKCs2ICD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8g+2Xm7dw+kc4yiDfDr8S5XUzI?= =?utf-8?q?05MCsoY2zlVEhHYbfeVHX5nuJLvp435akNPNzgXG/DcY3xu/nf2vfaWrzk62J6fcV?= =?utf-8?q?l7DbkdpvYLqTu6IAJuoe4M/8m62y97jnFWJxgVShj9jtnGNNG/pdDget5MIgUj0iL?= =?utf-8?q?8F0QPHASCoYvtLmoXkY4nrexmzSYz34VgC4uqQcwZlB11parI8r3gtUW0r13L2Z6h?= =?utf-8?q?t5UA99OmKKo1eo6+7X/vgt/pie563cX1+2eCVf6Id/CiB3lDpzly3vberCAOcC+G5?= =?utf-8?q?2967KR1p93Gjm0SIzVL1+CQbGRRnWs8KV+eNuv1BcYjazxRc+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/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b7EpFT03G9PqR9nWWjPYIMpZY/Ub6MQKyCkEme+9tfsZ?= =?utf-8?q?nMsU4wo3Bzb+RPxKm+8aUCHx5uZcODvbCv0dPavEbyVAijfQG/FH7yFixmzo32NsG?= =?utf-8?q?RLbDOsiTVvDsX2U+FcMD1Nq9pVW7Yl3ZPRRPiNcHdmzOzLjUrMSyfw22egLCIP0od?= =?utf-8?q?ffiC+mTPKr2TDZfDiYiKmYD4q2TQ0ji5X/uUfER6Adue9KzPsqCU5+Z0Lfy5HgFxB?= =?utf-8?q?HI0VIIAThgTalWSbStSCgkU/i7X2rzKqmRMuXLE5C12+2w8Un6K8WALpzkSTtH4/o?= =?utf-8?q?eoe1ZVDLOy8DlcJL8hW5fyIh7M/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: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: 793864 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-gpio@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?= =?ut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RtRuYXkHQ17?= =?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-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?P/o3sCLQU1SjyCfOAJ3JtfXnOVA3?= =?utf-8?q?saGM6dDBsyb9/DWyeQrxJRaAEumUNHdxzrouEnD12QPGQT6eWkgAW14wP8piGchlp?= =?utf-8?q?WAg//sq9cEL/fryjYPhEFGCQd2nmrFwSXM03S9Ma3TSFgV1Ei566KvfAg3v9tOoTJ?= =?utf-8?q?0yccbxMWAYnttGpum/pGAQxWPQrmlBVvfih43rZkUgg8u47rgzCssCYuC6EuZ8Hjv?= =?utf-8?q?ehNQbjK3JdWpVVd8w+9EPSahbYlFYtORmWXP9CU0Kw4/NkgjBuw3cPCYfpyFediks?= =?utf-8?q?/5ilsYweg8ARgnrSOGVEa18P1FiPg2KXHThvTSwisSi/aLRNJU7Hi1LGcY0CUMrG9?= =?utf-8?q?WhrXziDqHq12/pnjWEEEHGQ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uUZSvJXJwM/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: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: 793863 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-gpio@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?FRrykmuDUUAMUPqzzozK1DMXS/MNFbzwTRTj+02w8KZcdMqW1bZRc8RMJiYyJmO53?= =?utf-8?q?WQSsHA+PrPosK66opifyFKcM1PpYl75ip3bEaLwtAZpQnIHqf2gOMoS+1Cw8dC2dt?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M7D5jr?= =?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+mqoofPO9YNsI2fxxBaXbxxRHwdZ3TZXm?= =?utf-8?q?wRMXg2vyRFzF3mJzgNxeRBXJ+rRbpYhDGDWFCGWLAK5ZcCZC+CkLA0otI9zu2Ak3K?= =?utf-8?q?Hs6SI1Sli3odUjX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SUJdz9IjM6bzZgnJrY7iW2AJe+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: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: 793862 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-gpio@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?h4gK7R5lyVx4zeBwZnhqk0f9ldOkaXfe0QgGfM4MkPDAbRAHOJmvJrDthhwD2VBSg?= =?utf-8?q?rKsnLEvIHmzTKiocPMCaDPOo9SjsZmxRZNZhQckes170hLjTp6FAbCQjhHdfYrcmE?= =?utf-8?q?mpv8IGQ08CYFspyGDUHq05Jj2VQts//5ALRKI4O9ItQlf4mu3S3xtiBTzffQOf2Dj?= =?utf-8?q?lNJjYq9oAqp+nQwAUyOV6tcexzNpfwLSNw94jRWc28tpIc7zzgaerx3y/p4qmUa9m?= =?utf-8?q?aZzOe87rgB6+FHRTJ8qu0Qa93ngxs01EwuiMT9I76OMOfsZmp4CTPbaPoNU8R8nS4?= =?utf-8?q?++wriOf068MOsntMXNeLz9K7LdPrqInQ9lEnjH/9H7WbBYoNf3ybpxKSIc3rfy0jk?= =?utf-8?q?+KO1FpZmlritV5I8oCbp8CEIMYeoBPnioVxxu4U92N/ecrOM8h5+SJUvgz+MtLiZl?= =?utf-8?q?yX1yjIDWuZ2h6Wijuflr9JdhAFEtbui2Leo94wGNc811fBYDx/rxyq9BwikjKVoA3?= =?utf-8?q?EE60ir6fpecD0JigyCpiyjnrirp85Vvz5c440o4jKrkBKcVUUEQeXSucGa3l/lPe5?= =?utf-8?q?ranodxKFH9mGuc8cw5cA1HAh3nbsDhF88vudo5yEz8DkJr29Zv62tzcVzj5tBEX+w?= =?utf-8?q?APq60WelSNcZ4XHyG2ACk9R0W4i6k71xeMRMR/INdh4qM3+GXX43ewr/3zgppCzSY?= =?utf-8?q?z0m/CZsec5p/aFq36FbVg2kVfS9b/uTRC29ibKpy86RBTNWSdYhsCogg5CHMvCa6a?= =?utf-8?q?IYgAvDEEDT1nzq6j+MFcFgn86KujiDz5IJgvSlL/N69pgysGKCK85YjG4Vr9bp1X4?= =?utf-8?q?s6VyysdQIR3ZlGYlcx+4Q8oEkW5NMq8eyLjQnQU3aX/hdwP0FMdpZS4ZWCYLbR8sl?= =?utf-8?q?yMP9BWDKM4oxaJMUsXVw+p/NWY8YDV0gQx2vtUB+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+L5HG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= =?utf-8?q?fTqZJ9W+5kRhQoQEAdsrNqMqjwBQe8h0/JVASk4o02VlNtNnHx8/os6bbUdb1YSCa?= =?utf-8?q?r+mH2o5QLZ/CdCEYRNypn58SoKy0W2p9hRX1YEBTa4EbHTo3h/wZT13HLQq8nirbm?= =?utf-8?q?h504xShIclDCAZVvMDODEsBMM5+KLBy6V5kBbvF6JWn7vYw3fY557l4sSKnpmJE3Z?= =?utf-8?q?VQvjSLmGWtBHA/GRP0x0jbnA8QmfrNe0wYkH3keI9NE/LNXp4odCUIaLk0FPrjldD?= =?utf-8?q?paEox7ex5jgLCIdSS2xdJhN3WpGxJWHgUTzLtA6ZzfBqTu+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: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: 793861 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-gpio@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+//d1za9LGJl9yCbkd5EeKlb6w5MdTXauETPBqhmkIs9/LVPZNxMNQaQ?= =?utf-8?q?23iux0nC0f8D5pOWFbx+mZWBmioRCtmEJx5V0SjipkDh0CTVO0IfQ2eoYybrvlaID?= =?utf-8?q?is0ajBr0y0yBJ+XPr7ldQyRxvBiV+xLOccwoXI11A8UtjiPkEX6mDMdgxkGLIFSsz?= =?utf-8?q?3d/MmRZ903dDd6e1mBYeiQGseHz5Vt58GK+tRBXaWJJroc8F8WKLnU3hHI6OsYU4l?= =?utf-8?q?fxbC0kAyC5MoyZJChl4vPFFmGH3lOT1HeC2UNZkp7kcWN0I5l5Ekl0n7/D8AcM0aC?= =?utf-8?q?i60Bmk05Ak5C1Ekc6H9DEpefuQQdCPDQp56VEaE0utc5bq6LIdZ7BFd6avwhkosM+?= =?utf-8?q?Vx7tw0SW7qj1GG4OuHAK7c7i64EWUch09y73Mkgyiob55/dYOBjmFeeOImqCqitvP?= =?utf-8?q?pJ16I7txEh73cYutrGBbXZGSBLNlittI0MJzF5dAG+pvszoHPXVkJF+8KkSJgPCNk?= =?utf-8?q?1NcUgyGXhTt6SXr2kK4SgOrPxeGTm5tWyYGUjKpqztAZWUDH19QWIY3J4fZh64G7B?= =?utf-8?q?Wd0bBlnQ5Hrs2CjlLiyKN20hoAyVBKhBhisM9OHTFws5GSi3IOynmRkm5RTCKnPfQ?= =?utf-8?q?WpE9b47poG3cifNlHB2RRekbfYrMtuQYdNxYwfSj0RIUyf80+Qb9Zry+kpXqNvRx+?= =?utf-8?q?e6ti1LpgBUIRx8TIid0oekv8C04ZxSNVdXT1H0Lr0xqK2CH5lrTrH7TteM/7kUKOh?= =?utf-8?q?kFLUs2UPAg2XwSsXH/eThl5c1NSZ2JTzBPNjKLSs1Iak3SCgffkaRpfS0f4BkPsNw?= =?utf-8?q?AupAwiFap+t4lU9n8yuIE6I9pCGi6+UyT1irlViQ31xY5fmEXDr4MkTuO9wZqfnPt?= =?utf-8?q?9eTakyZjgYksg0f9VZyO57zPE04NNioiR7U1ERMvpSKophIS6cvC4asPwr383a+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/Zlnti1Ad72MYvVrKWVcQ4KZ5HCgrzZo2jUkQUTYY2zJ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wklTvNUiNPvxvz2Vy3gNmh4?= =?utf-8?q?fhkswmCnaKh9aPdiswErNc7xSD34q2h5C3m58RRvgFuhMzURy/zQ1JpcxA/JwrVSQ?= =?utf-8?q?c0CiZiWfTeFsVsKHmkAKKcpk8ScIGA85jND06j9D5x+Lnr78456XotLC5jrvRc8lN?= =?utf-8?q?ShIQQ2Ion4aznKCqMj+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;