From patchwork Sat May 4 13:20:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794670 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2083.outbound.protection.outlook.com [40.107.249.83]) (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 9CE2B4A1C; Sat, 4 May 2024 13:12:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828377; cv=fail; b=Kg6++inJDR5ulm8dMxW4kBW1az63A864OB8IPbH66Iokt+oOnKS3RrQMYgqpmEkQMxyOJq+SnEycY9K8fHqJJpuZ6fPiHGhpn8FwwALXMlgjtuyk7S6s9bmAXFpybSVAXzJb4Ny1Pdpe4rKzrjbO+IlvqOOJrrnMh2uz7TFNk/I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828377; c=relaxed/simple; bh=O584+LvuF4pyN3SkcooP3Ifi0UGy7KBPUUWirXlIAaY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=R/dx8IkvkYAlMaHqmWB9omBNWhl/QC37Ta6rgLKap/R3IM2MR67r21shHESFNlIbgzdBgsYp+4hP/bbLEtSi41Oyw4i8EbQ9/a3VE3FO/pahW+Bo/VrOXwu9Aa9UZLlNosRJK5CsyYbJ3CDDP4nMteno1LzglHpTLvX5JsDSBPU= 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=V349u3hI; arc=fail smtp.client-ip=40.107.249.83 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="V349u3hI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PsBZCp9Q2DoZaI+7hZlpN4AV3qyDi6yk7j7xxI7aGPT+2QAuqBU8BWUZRtyjv5ta58Tjp0X17Pj4FUsFIUhwx6616LxpbEML5R1Ge0fKCdWbw8EiidXONIprB2Xp01fjzqw20PD/0PwOIvndEJM96+EMEmTohkJ1lWum4EBeydMmKGozTV4yYBXpD5+8N9JKmqqkt7bbmuA0ZA5si/2/imZivs5R8QM/eyZf5o/7FJahC7Ymfg5h8X6hAcOHR7+YWkS0MBYx2zi0C9eorle4yqBpsSs8nmrYHAVjEjwPJmNjk5roVvDrL6UfzL/+YfLoASCQ4gI7MUA8tV55yPaq8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9XH/O68wWJ/FfHgYL+Kkys96wwEpB5Ik6VZZUTwb4Mw=; b=TWncYo9doring7vInD062OrPa8mLEYYPnQHCKdGMbQ4nwgay/lYItCeIzbuggHKlNeECzTvi9foYcxGeNknjR9IKymosX2iGWN8xXy73U3+Vu9K3QAQiGswibNii9Q+Nl4hSw08IndO6k0s9Op6HkrTJGjGDRKJQ+kZyhkic4EtI1aecDrvzQqv0Fb4bjZNBMkaGuyfL7i+MInmsqksnhJ3OvHNDCCSWhMVtfLv0/T5HM7BX5LNVZ+2yeTLknS21cBk39N0cqWvodUUDth9uBOxs+94yeIjQDuL8vdtdoGxjSDbkekeqyB4bs6/uNcq6ToVOHx3LjaWqiIvORVZd3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9XH/O68wWJ/FfHgYL+Kkys96wwEpB5Ik6VZZUTwb4Mw=; b=V349u3hIj3jx8cbwqgkcfFeYcAviXPW4lFmxDNc1jpRnCj3N2UqV3+1FNPMZisxIMljtshFftZvf9/CqPZF/gwdakXv3n++Lu4Sy9MydaP1a/VvfeQHrAQFT2+jWoV4WSZYvwvdlm+9h7N/D5atkTpy3EcMi0t+yX1XnvLDWNo8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:12:52 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:12:52 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:00 +0800 Subject: [PATCH v2 02/20] pinctrl: tegra: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-2-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1919; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=dgr9gEpDJDvikxHa9ZakH2O4ug/ULsl0qx1MCE8QJXg=; b=c29ur0xozBQHWw4UNa1DPvMPB/3nv84hzDNq2CwMxaS5GG6IYyoT0/JK1IrVkkQRteonbSNKJ JhK2UeiCgPTAeUzI40ur2LqqsCNKyNGdObHFdFgxDDw3tA05J72cW0s X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 567fafd5-b163-4390-58c8-08dc6c3be7cc X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yaBaAp0n/XaiCLVmNLKTzI47WLUIhnH?= =?utf-8?q?82QFvY4TwOsj8ejsIkl2uv8IlJjlK37Azd8ku+dn+YVbbKQfcC4CA77pA4YhgdxWO?= =?utf-8?q?tq/hdOuek4hBy0yupbJ/5rony8uB3hbpHUVLgSMGODjknbfBQYrMQHdOvUIFHKAjP?= =?utf-8?q?oi0fuM9M3IuJDwRnDfGpUWVZkA/dt4zFwcgdFZZObZ5mkIm/TxzHo55iuusoCxNU5?= =?utf-8?q?B7c8OIUVot/SPjWKzDPuOjg1Vy++0j9I+zZb1GGgE2UZuLaj+q1u5Onv94V7Zt+kq?= =?utf-8?q?VYaaOYcMkpnLmFqCzrN85R8KG5h0RCjXf0wXlSYod9wjM1VvDWUu/40vrBaq7hpKr?= =?utf-8?q?zgCL+J0hP21Dr/kRpGIX6zFWOg7HrqzTzWqMg4OVo1bXYHpneZWNWw/Zj0A3Z1YaV?= =?utf-8?q?rwoOLX/WTbm+kBNG1P4GM0i0FUw64t1k5OFs1QLNEgrcNk9zNMmXUTnvIf4pBm5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CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kXuL4T/o0DiUaqT0OjhdOr8767Ig?= =?utf-8?q?MHS4D+c6Mlb+5Q3IBb0CRzPLJ762GdfmUOXnIMBAG297n6WWKA2vOpC3cjHq13CIg?= =?utf-8?q?7fl0mNqsKf4re9ei9eRfUQPTbsG7pP7dBg2fhogXee72OvckcabwCwK4PYLKHefLB?= =?utf-8?q?BSay6keQTPRqw0oA1ap8GwM6djgVanJ2ZNz0SieHFKbXWtvzBAX1ghFAogbeIosPm?= =?utf-8?q?3hJRyvRIFRkRRuRK/XwIniHyKpHh42ymITZIl/eKe9rAJ2TNOgzOMRzU0xpGyvcFs?= =?utf-8?q?MgTuj7sEwnvYZfgQZz2ZQo0L3d5ng8jGPmmQGpLMcNCCvYmwiRBuy+TA8jQ652asK?= =?utf-8?q?6+6BGvQYMlqz/JOxz6COhvl7LmP5gQvDIUGbPAY7KJDGisvhccVIbvKurItNDBd3i?= =?utf-8?q?xf5iDZJu29QWB56BVpjZ0DlFYoPmjKAqzT1kL5lMqgdoxt5iHKESca1G8wKRtvfoL?= =?utf-8?q?l8qxKTUTkVu9nvUEEMxClmO41iTuVhgf48qpEyYTwiEKNj1mpmGWkQQpQaZFEbaWD?= =?utf-8?q?86boALHOmxrJFVJl/oxFuLFCAs/D9YZ5LEBNez9M/5RXFRRBgPa0DqLwZNL+/fReU?= =?utf-8?q?HhnIq6AQiJzczVq4KOBwcWhp56ZneqVhBiv8X/k4tqgt5OezjpwTHbkX+GTUkpWhH?= =?utf-8?q?2NwQKuKK+OO9L2CVf34WsZeBn77pXSjTcBqBskgPIuNUKxj76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-Message-Id: 567fafd5-b163-4390-58c8-08dc6c3be7cc X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:12:52.8610 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4sy0/+akhGM1b/xMzo7AidLZmxf7iqXZJ2mOFSl12FWS2ISjCqiAQ+I1mwlX0irAQsix20v/1FTiNUyCDxWpQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Acked-by: Thierry Reding --- drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra.c | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c index 96ef57a7d385..49c5edeba87f 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c @@ -238,20 +238,17 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl, { struct tegra_xusb_padctl *padctl = pinctrl_dev_get_drvdata(pinctrl); unsigned int reserved_maps = 0; - struct device_node *np; int err; *num_maps = 0; *maps = NULL; - for_each_child_of_node(parent, np) { + for_each_child_of_node_scoped(parent, np) { err = tegra_xusb_padctl_parse_subnode(padctl, np, maps, &reserved_maps, num_maps); - if (err < 0) { - of_node_put(np); + if (err < 0) return err; - } } return 0; diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index ccfa3870a67d..c83e5a65e680 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -188,20 +188,18 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { unsigned reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = tegra_pinctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } From patchwork Sat May 4 13:20: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: 794669 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2045.outbound.protection.outlook.com [40.107.249.45]) (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 7F59B2869B; Sat, 4 May 2024 13:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828411; cv=fail; b=JQYGd/J2iZ3Nql/hzozIRk4E16DUJVPwUNAA3/oLV64plyEj0b6zUESFGBsnd2ZPFxWjEUObcZ/Mbz48vk8ygluoC6Ccjr5OtP3TnhOxl992hKnFnsk/bqgSWaKiU56uqbsOE0mLFc5ZkSAksY6bzKuyRrzojMCoXdGGaiW511g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828411; c=relaxed/simple; bh=F+EfADWV2CbYDvWUwfS8uybiJnwFWQ5dJTGce5wgt0c=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Y6iO2vFqUKYrbr6ymha6wKogSkvnbF2PpBUBRzTWjMyzuY1xP2fbFTa14SBkxxuYo+xlQuT3hRmlTr7b7hUq77NE2MXzxDGixlVc9VLs9aKqti6skCJzIUxCcwFSuUGZrA8aXr/ZTbdTzsokZQg52PJ2Seg6uHGf1/H2/08Whxo= 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=EPpXBiBu; arc=fail smtp.client-ip=40.107.249.45 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="EPpXBiBu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W8dFrHb4e4KL7HwgGceMdwnIPATbwEajoCf0r1L751fG9TntfkojtXEFdwtU3+h4mGisBNyqodX9P/617fvvKWFPWxKVesYpSiNfQ8n/RRhkSVTQR/G4CqrXUZe5kqbNc18EwGKBOT+1RnK8SpANUOyYwY+SEYB4G6SDHCGZzWU8pzS94pMbF3xGWG6I0U1Y/Ik6reegZfH/pLahiWARc/kW1s+u3iYzsC1rwNBokyY+YWDlIXGS8lXQsaXkiRuluFYQu/tKOoN4SjT/5FMPs72IDiKaNoTvOWhm9gEZs1CAFtzVyUqLHFEOiFHuKC8zBN3OvjtFjjADEq70ZaZa2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2P30wZxS8Lt+11rd/nJOtDx2uGO5cN4rLrSAJ1jfCLE=; b=O62izbjHXj+4zdPt7+GiEoTPn8XodB2piI+Ga/xTuqqDcmWL9YM1JeivlJYchx61wb9HDbYxTJLgAgFo78/feSpBITmSsIsQX2uoJDhSRcT6zzZFFHcazvbiyvXEQYS8Aknsm1YD2Fgtg5D7ju3xiiP0MhbXDCDxFyRAUr7g8L8rP1Flxz13XuN2u1BOr8zF2XKrHV35s8AmEKn2fFtROZTMDgax8b0ny/gsVv4roL7RxmNYmvTuEgeMn5UjyvjEDOO+UCObxyNXu7b9BuyuGZTJPIdJO3NFSvTsSEj3lqXZTbU2W9zhsII+airVQrB9JAMhp7lkwyNT4Cu3blGHoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2P30wZxS8Lt+11rd/nJOtDx2uGO5cN4rLrSAJ1jfCLE=; b=EPpXBiBuohwFfGAUtTWvLzMJ2DMt4ltyln5SdZNBx/EDHOeCEMyumXCN8/sG48I8pRdal8qf6VU3jh7h5UhovOLHJgRoiDULw+dFDM21AVVJh135v+SO6E5K4vjpdQfOU1ITVUyr8xhWADRG989kAil8xzzq+wC9G2PYy63kYBw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:13:26 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:13:26 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:02 +0800 Subject: [PATCH v2 04/20] pinctrl: starfive: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-4-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan , Emil Renner Berthing X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=6725; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Y9g/ve7R+m3W/e7zIx8b/uEfWQwRmgNvX+GDch7Of5U=; b=3vMnbw9Ysa7jrTpC44efhMT+UFQsFvhEKHMRSieT7F1Sbddy2bEGEc5EfpALwgSvWWAxat145 9aXjF5wEdpVCTILYnh3hhNbtAWkA3LZyCxa8WDZMWvRG7MOlkDt1Wen X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b5c4df5-44d8-4c73-20b1-08dc6c3bfbe3 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+gfrw/c0aUOQC7aFNAxcqO0bhyUV052?= =?utf-8?q?FRMAXxhbS8Y0RQJM0uBh8b609+gGNG9mrLIkjHeE4a+CG0iHIiYZOEMi/r3wQfEBL?= =?utf-8?q?kq0OF7xqPPLLqn1ERVpMXJxJpPVX+VUG6iZNWT6ocCQlcsayLGI62HldWy4Tq+164?= =?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d+IRx//rOiQLHTN+ZOfKVKu/I9UyC2/Q6G0xdcrSdKDZo9GN+WuQmEZP?= =?utf-8?q?13MG4kKNrAlcSCX7EgPSGh2MloVUhUitG+Yy9prKeWcSmAYSUw38+9sIiH7wLdnVW?= =?utf-8?q?jDvJxcWGtII6jW1nwrAKyc/alskPVQlqV2Dl3xy6Fu/LdNTR0VVfAd/uLQqbzNL3o?= =?utf-8?q?I/2P+tDvj+5KYwPPoIjWE03y5ldU9BxJitkMWtj2WlkEWVJ/fH6ockSKl3FBufz6H?= =?utf-8?q?7P7cpbY3ZkwhWr+UxN7WtDpFuauAHUjj4roOv7Z8aHFjl3q8i7IQtP6s=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cmMrAeEEFong5d3lrzGvP5p0m39H?= =?utf-8?q?kIGNrPvNxVsQdlv2luYZ66XwTPBye9qMRnwTQYXZdiYKHNGMHrFgWSiWMBkdLr+Ff?= =?utf-8?q?SWx+Spny+4xkA4fTn4VDP4j/HnvfVDPjT0vLGX4dXOo/LMb+dv5BO1IH7ZQoy0sRa?= =?utf-8?q?IVOuTRL6aBAcb9GZLFBLnpacegVAOLw4NuuPEpm3FG+2MLBNXk9GlFN3fRxE7744J?= =?utf-8?q?Oy12ClRtmvxyNGqTsIhVjMI4X6Uoj07saNbleEzm1OFr9SpO8PHQk2AM0ezGbduhB?= =?utf-8?q?dOLo24ri/bsFNeHriB6Eu/4MH+1du/uCuIDBfBCk2tDs+PeIIJ8N0AN7aMnXsZX+U?= =?utf-8?q?wdHsUPCvzuVkA19G6vh0zekFfr2fjFF2aBfzzXA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C0wbr?= =?utf-8?q?06ta+A/9dXfIgjO2oqSmR2jSqh4fvHgQFxlBYv9daF0rntdzljTlXg1KuMBGdBLb/?= =?utf-8?q?Y5CLCfuWBCFBXrJxid+29cNR7btMw/SqOlJG6U8C84eU2ysKLWqqcAVMtig15aFzN?= =?utf-8?q?wscxr9/b+p1Xz1H5uTyPrLn/fnqhSgl5FqAcnYmxYPTTcE76ioGNKHJBBaS6OAqoC?= =?utf-8?q?NEyIZRpC+uxx49KHxHTJndacYDlfTNxdcCnHzuiL2rxNDZXthDH4qtOAYpv32DzYh?= =?utf-8?q?9COHf/VGFMxv?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b5c4df5-44d8-4c73-20b1-08dc6c3bfbe3 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:13:26.5554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IsKCV3MzsPaHV6FuLQIUwE1z3AlbnmuFE+6k6bOen/PYAptY1ACmRlUrV16UCorDIjT5k+tijSoDho+Qyfas5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Acked-by: Emil Renner Berthing Signed-off-by: Peng Fan --- drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c | 27 +++++++++------------- drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 18 +++++++-------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c index 6df7a310c7ed..27f99183d994 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c @@ -480,7 +480,6 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, { struct starfive_pinctrl *sfp = pinctrl_dev_get_drvdata(pctldev); struct device *dev = sfp->gc.parent; - struct device_node *child; struct pinctrl_map *map; const char **pgnames; const char *grpname; @@ -492,20 +491,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npinmux = of_property_count_u32_elems(child, "pinmux"); int npins = of_property_count_u32_elems(child, "pins"); if (npinmux > 0 && npins > 0) { dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: both pinmux and pins set\n", np, child); - of_node_put(child); return -EINVAL; } if (npinmux == 0 && npins == 0) { dev_err(dev, "invalid pinctrl group %pOFn.%pOFn: neither pinmux nor pins set\n", np, child); - of_node_put(child); return -EINVAL; } @@ -527,14 +524,14 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; mutex_lock(&sfp->mutex); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins; int i; grpname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn.%pOFn", np, child); if (!grpname) { ret = -ENOMEM; - goto put_child; + goto free_map; } pgnames[ngroups++] = grpname; @@ -543,18 +540,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { ret = -ENOMEM; - goto put_child; + goto free_map; } ret = of_property_read_u32_array(child, "pinmux", pinmux, npins); if (ret) - goto put_child; + goto free_map; for (i = 0; i < npins; i++) { unsigned int gpio = starfive_pinmux_to_gpio(pinmux[i]); @@ -570,7 +567,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = NULL; @@ -580,18 +577,18 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, ret = of_property_read_u32_index(child, "pins", i, &v); if (ret) - goto put_child; + goto free_map; pins[i] = v; } } else { ret = -EINVAL; - goto put_child; + goto free_map; } ret = pinctrl_generic_add_group(pctldev, grpname, pins, npins, pinmux); if (ret < 0) { dev_err(dev, "error adding group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } ret = pinconf_generic_parse_dt_config(child, pctldev, @@ -600,7 +597,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret) { dev_err(dev, "error parsing pin config of group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } /* don't create a map if there are no pinconf settings */ @@ -623,8 +620,6 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, mutex_unlock(&sfp->mutex); return 0; -put_child: - of_node_put(child); free_map: pinctrl_utils_free_map(pctldev, map, nmaps); mutex_unlock(&sfp->mutex); diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c index 9609eb1ecc3d..4ce080caa233 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c @@ -150,7 +150,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, nmaps = 0; ngroups = 0; mutex_lock(&sfp->mutex); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { int npins = of_property_count_u32_elems(child, "pinmux"); int *pins; u32 *pinmux; @@ -161,13 +161,13 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, "invalid pinctrl group %pOFn.%pOFn: pinmux not set\n", np, child); ret = -EINVAL; - goto put_child; + goto free_map; } grpname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn.%pOFn", np, child); if (!grpname) { ret = -ENOMEM; - goto put_child; + goto free_map; } pgnames[ngroups++] = grpname; @@ -175,18 +175,18 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, pins = devm_kcalloc(dev, npins, sizeof(*pins), GFP_KERNEL); if (!pins) { ret = -ENOMEM; - goto put_child; + goto free_map; } pinmux = devm_kcalloc(dev, npins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { ret = -ENOMEM; - goto put_child; + goto free_map; } ret = of_property_read_u32_array(child, "pinmux", pinmux, npins); if (ret) - goto put_child; + goto free_map; for (i = 0; i < npins; i++) pins[i] = jh7110_pinmux_pin(pinmux[i]); @@ -200,7 +200,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, pins, npins, pinmux); if (ret < 0) { dev_err(dev, "error adding group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } ret = pinconf_generic_parse_dt_config(child, pctldev, @@ -209,7 +209,7 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, if (ret) { dev_err(dev, "error parsing pin config of group %s: %d\n", grpname, ret); - goto put_child; + goto free_map; } /* don't create a map if there are no pinconf settings */ @@ -233,8 +233,6 @@ static int jh7110_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = nmaps; return 0; -put_child: - of_node_put(child); free_map: pinctrl_utils_free_map(pctldev, map, nmaps); mutex_unlock(&sfp->mutex); From patchwork Sat May 4 13:20: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: 794668 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2068.outbound.protection.outlook.com [40.107.22.68]) (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 BBE262D058; Sat, 4 May 2024 13:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828445; cv=fail; b=K71+/2QVqCxiL9jHW4ewZ/iIXDcU/TcBEnTfIaG6/NnYGIS7cXj29BM4zLw2LrA66B3SWuz7CzQVlh7oKuHjuyeFj7V/4Hpp7nuc1r/xxMrc+JKdAhga8Ij82oqut0GwKpxyIR/96zj/ZKNcxhCu8amo3el1KG4MUli9XDppmNg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828445; c=relaxed/simple; bh=OInO6yAg14U2A4TIttQDy/mS0VvP7xhIZA0f8KUS5dk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Q/PervaaOdNx1hxFuWunhL0wwFOs9vyT3ePpuYKlVzI/x3l1urrhJ53oXL8KvxCGmTcT9fW8hllizBTh8gw7Ry+7paqNOfI9npN0MxVuAsyj4HMDqAiokVsEHxfouPXWlMNoNN/J7PhIjZlBmvov5i1Q5EKFFJIVjJahEQERshI= 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=K9HoFs+8; arc=fail smtp.client-ip=40.107.22.68 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="K9HoFs+8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BB++BuCWovknZieJLe0ezXwJ+LlNNUJmOh0r5XrnwAwWqL9Hl8BKUM0C1XizqtjYZfZ0i+bX5qH2cv/biMOHoFZfdjxbjDDKaGwbGOEPf1+IEnCLneloZqj0Jfpk7hNcEFVo1Yr39KkUcd8NAwWmbp6oKWLA2LvtQ8EfgcZd8cYg8xeV0LUBUUOkt3FoC2GUyBsVqSZNOE0XExVjRQkd6RC+joEfrvaxBYs9aKd5wlylLZNXITXpAF3nHYZKHlIBPD0EevH7lE2F0rIbmam7K+ZeUxgJkrZwhh01QyD+qBT41Smn0I3+pq1mVBkvLLqKX8M49lpF9HY4ADjmZdX5JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=ZmFpipRA/d0vqDXvfI9t2oC+JpQwtgSv3XbrgR6cvNx9nIZBw60DisGv1ZoNEkio6wqCcHPrpGcw+J6e/JtxkGU9mWcbYR+OyORhMgz0tI+G2p2uZPpyIqJjMH6IwEv8+zIQZb/tjOAfpqPCbenJPKDPneP2+gQeqimhb3fDzspZNZpMJSIhbca0rKMq6r7GpAnOoLDN2ssRp9kaiWoVK3Q+rnj0Ph0r1NZBS7ZqBZc0ug7hhBF4OHZ1dFVAfetlD2YqudsOGFYdL5cbwD997ZgQJIe5/ETDjVZWS9sz6fU+kqHQwF0KEwQQAvR/rbAcryerI8aZdLy2tLxWwCA34Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=K9HoFs+8inZwiLNq5Z6MwNjq7DYsbc8JTeDqn/VxH2PSLW/7PNxhcix9EnzKWVNkwzRETbUqiIwcU4dbsWNglLL+0n+O7EcO+MsssmI20feQ0DIJuT+FAKpwdmWX0s03dV+f9DS7nr36WsAprRd03x2hSVbg/RedEz8stpoDajc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:14:00 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:14:00 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:04 +0800 Subject: [PATCH v2 06/20] pinctrl: spear: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-6-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1599; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=gLxq6qceZG7Nsihhv4/AWrdppvVafau2eKIInT5INMM=; b=5ffTl8ZtioLSYaaZNjD41K3m0KxkH56uyb2/IQ3LQ/eLhFTIgJ+z+teWheN9sal8KHmc+TJHg AnbJfBYdZnCAlHsBRS1fxFEmq8MQgiKr7ur+z8H1JXy6MJM4yebyMux X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: d6598716-c0c4-479f-c7a2-08dc6c3c0fe3 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?v4QQD4arqp324xwEu0I3XenXYFyuw44?= =?utf-8?q?jF4y8CXbektIia+4edMloewgv4Jij3cvDp672QGahtqzG0N3hBY24JXVacPhSA0nk?= =?utf-8?q?YyMnK9YW8vb0vQDflfUVh0S8bsBZ5EOikNWaFSnDnX+p32JhkrsQr/IOaPhbZ6cHv?= =?utf-8?q?pZ6bfrXdyreJ3T1xW5xcstRCu5ugOJE7bteLND1M/xxYAWYxaShaDCjxX6LSsTfUn?= =?utf-8?q?eySDCuXOEa3uxOQnW/mW9tpih4waqYM/SJjNAesmpCEw04G3YSHhPBjr2Q846g/7W?= =?utf-8?q?1fNdopM1kfodDjsAT7k0ZUWIwIEaEQOMfpgITcZSYP/uym+HTcEHMsf7rM1Dn3WU+?= =?utf-8?q?WgIXGBHRfFNNleOtrpcvB6KZLGfp6SCc039nNVE7ZXWBYSV+VjZav6LVa6gBpeiyq?= =?utf-8?q?D1YOyGgYh5Atv2JqdK93IR/RxKjGvgsxZP8XifkNNoHRM6JCCgJgsWJMUjyM3+hCg?= =?utf-8?q?zmpBu1Tj5mUKYgb8ElXZ3zT9KSsys7TBH72fsurmCitfuUuv6eSeZu3oT7iGlTPtX?= =?utf-8?q?hNzLjthTWDnqbL35xlaQbp8xFNN4KxyD8fLS7bFK4rDRazwA0Az6i6ACHkllnmkI2?= =?utf-8?q?voh5ztBZLQ2Wz+Tcpckk11JsR8IFkKAB9Aq5qn+vzFOI7+vVLKlftM43MPrhRvR5F?= =?utf-8?q?NnK9r1eDbEcndJYvQBqhjyC5P/OrP8ai7p62ZSUD/w9HLtGGca8Use0VAzQ4IIklc?= =?utf-8?q?GOMqWo+9dMKEWPkV0merUBnN4fhw04zpxqsskPBa/vjNetk/suPgEzcS7EP7fulKx?= =?utf-8?q?NYHG1GEQD3fG+iDo5sP4fHmoiJaGkhL0vADAKzViMFUx/wk9KqYSAcZQSYCJQ2WRa?= =?utf-8?q?u8P/q/7Ubeg/h4xcWPthPRBH2a3MV7zXxCeT0dm+tktVk5Qpw+/u5KBrvXMSs5vvC?= =?utf-8?q?rux20f9oS6N+pOO2XM3Hr7VmU6mAoixYN0LKgqW6M39GmNWK41zpL0WN6tQxibjbD?= =?utf-8?q?I90o4B0bREkixdJ2hX8mwV6E4kDRdlyh9vSrLfdhB38p8VrUOukkvHfj3HKPNLAzH?= =?utf-8?q?2ei64zteWWmEQGbaifVj+qqaEE8RL81f5PzH+Y2rjk95bsJFMZckRixsf7Wr/iwCl?= =?utf-8?q?hqAPwzM3Eg2HurogTVnwrpQWUu2mewTWEKFHyH5231qbv8/JFtIhG/hKIl5avoRMV?= =?utf-8?q?BlHcSbMCvzLI25PlDloFuUIvnI6ohMwU1bfpuE/LY2TknTFBW8cQwrcagRxhI28kZ?= =?utf-8?q?rzTJHI/43w4El/3/zYuGyV3qzdrQ9pka8QicjNO0jaifMdnGh9Q//pRmY4oYQxuey?= =?utf-8?q?Xt8EeForY+/1ckmGgN2nPodn+Cxj++E8zHGQSs6kMG0dJETboHMXr7ZM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/MCkjX5+ilHcYff4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LzfVu?= =?utf-8?q?g/CJ1tTJctEodGLU+yfP/agZu+nk2u75vbNFTAuxKi24b1Z+2oixFishNMSSKMHM5?= =?utf-8?q?0UH1kTvNJ0NGLNzZh9ajWX4TT+/qX1Rxrcf6tQyKGM1wqVXTn1kLuT7T/zEEGdcld?= =?utf-8?q?ka7/jfmROXumhatbtA85tgJPoUKewZ7JvB3TKyjekHO75oMuusepcOq1qnJ6e1+IF?= =?utf-8?q?tXIg2eYC0GhEeSh29l3sWwpA2K93DeY1JpL6dQz3TYmjuvoFwA+VcDxHjjtoKre2C?= =?utf-8?q?MP9QfZvpeJo9CdI9xFkGX62JvDQlY6YNBmnmhHM5XbiyWobk6TGaqWBIcYYYa+IMW?= =?utf-8?q?5VxcpzkC0jDwV1lPYch4gW42DWNdxSqUUMgVb3qc9kNLw36fQ+VLmBf4fYznM+iTg?= =?utf-8?q?DeioubaJZWq767LFFlz06L5JVLiK0q76f6yw1EbaFgY5IfCZ7HMWBJ0hLFrHiNwII?= =?utf-8?q?vG80z6TzPhtZzIdonG4p+jOMM10sgnYq9iHk3bZDWvg62xbT3FRn95PUGE8ukJh7P?= =?utf-8?q?W6GWxSniMT9pUw0YSepPChuDH3QFIus76TawBwP+9yDOC5BTVixWxIDwKy/aZd1Ln?= =?utf-8?q?ptrNsh6WZJfC2pf+hCeXETzdkB5G3rmYG3tdjSuBtAgniK2BcUWJ1GaUFhRg4MAwP?= =?utf-8?q?gc8fNxfZlsKA?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6598716-c0c4-479f-c7a2-08dc6c3c0fe3 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:14:00.1186 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T+cymmIPNQaUTjAAeGY7giHGdI+UShMOKcu96YfvdEpUl5E3Du0kUO7KnLBy/GG82X25bBpZf2YVHU7iNXWLEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/spear/pinctrl-spear.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index b8caaa5a2d4e..a8c5fe973cd4 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c @@ -151,24 +151,19 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); - struct device_node *np; struct property *prop; const char *function, *group; int ret, index = 0, count = 0; /* calculate number of maps required */ - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = of_property_read_string(np, "st,function", &function); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } ret = of_property_count_strings(np, "st,pins"); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } count += ret; } @@ -182,7 +177,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (!*map) return -ENOMEM; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { of_property_read_string(np, "st,function", &function); of_property_for_each_string(np, "st,pins", prop, group) { (*map)[index].type = PIN_MAP_TYPE_MUX_GROUP; From patchwork Sat May 4 13:20: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: 794667 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2068.outbound.protection.outlook.com [40.107.22.68]) (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 79CB72868D; Sat, 4 May 2024 13:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828482; cv=fail; b=Zmd9D4oFaKyrBZSlCFp0F/jfrCzQ3f7/JdzYjVvapc3t3+6wYETvP/NG4YL/ajHIebw3bJYLJO81EufoA6aaHn0egBlQkfrS5D4Msobh9rBKy63Xms1/0boCMnS026eBG43qcyo+peCVdvm0kplq8rPXuJ0YP5F2jAvXkJ08JPI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828482; c=relaxed/simple; bh=9hvlVy6b1eo5pxJBgdmpuQ0CR5gv9409rTkOxz7XFTQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=sYO0t3YPqO+LEE4m4J5NG57Ejxb0/EU80m3ibtAI6rumv5yCi2h+raAbfgL4lrIWu77QNvRQGfBsLhejD9FCLg2PLYDNT2+EIf1K9KKvJR/zOS0ewuapQR4aYNwDsVWlVvqzfhbkzbyrArWJJQeSQh1WwuJF3UDlkLKB6IXSpvo= 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=Dj+fXKXO; arc=fail smtp.client-ip=40.107.22.68 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="Dj+fXKXO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fWXn+HNPyiNYRoDQDcAcXp4xArKAw/y8SFe/oayt6TItkT60kYUvZw3LsUO5+w8cIdM28YEM0q3jSoDZjWtLjKH1vMktTx9G+Rp5tw8tG12E6+Jkd1fCM9BArtum/H5wgxpfn1Bb95X/Ews/RyLiMruVN8cDELzVsEVzY1UZR7wDnWfqeWkTRZsRQul+UTPmSVatWS6CuqONLusUSbHNXhVzqEp9DU8Jpng59kI0wbZ+aka+RHpz8K7LuIDqhqXDn7JAlA+XA8ctk8Rejq5LcG4LSEBMHd/ol1CU6A6CLYrBkyC1MCdthm5B6uK6B7xi9RiEmCOL7f4rpMLgcjOnng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=epf4L/dpti+hg620NqhC5qYH7xMXGAi+pTHVtvEELiU=; b=AW82+A8IJYGHbQJto/aGxXBevTqLMwgnJF8ET8BsnuEFzN9iskxYO6ib6PxRmfaZWPiWt+n7+enL4Qs1oUPPHwzPF1+IRaClEHwU23lvKPCVfhAMYmdw+FVBMlmjAwgWulJcaoSsBR6Km8JFlf2uVzuu7QM8GYd2DQ3zFM832wieBJatzEggMThrR7I4RlTruCweTk3JYo2qhhEAjP59J+lNCok7UKn5smB2TedoHc+hkW6nd0R5dqf42vkE5U7Xj1B0UMBl8jxKKFgS8AURB2VnJwOhyz2TPbFrjS1u/vt8ZpXUjNbcRJHiu5uloSUKjJAVtMndf/iI34wVaebWSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=epf4L/dpti+hg620NqhC5qYH7xMXGAi+pTHVtvEELiU=; b=Dj+fXKXOBD1vI5VZVLaZnuBzZPwOSlnDkyrIq5Iit8VQPl/2J45TnEi8RICFxnOSUXd56kwto8odRlP5WmKXOXHlN4n/sHVH7BL856t0WxL5kawMYOTMcVZNHJ10JhXQq8plNmxx/hBcrYzNdjuJ6B0Oi//pM+j3bXhvDZtgjOQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:14:33 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:14:33 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:06 +0800 Subject: [PATCH v2 08/20] pinctrl: st: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-8-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=3917; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=WkwqgZKiLgnl2jfID+Ud31pueZUfzLGyRuwnbdcTMcE=; b=54q7MBEBsmgWVOdKQelInf02EJz/WtXPNBQuDk5mK2LcLLCBCOXVl32net6pxq9g8cBTu/cs8 PgTb3cxhzI5C/dbPij4nnc9A51CT7/Xx+UEJuEZwAX3+3Z+P3Zwv4ES X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f5ee1a4-bb1a-48ca-a0c5-08dc6c3c23c6 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vwHuJMt8Ffbi6PRESJzDXsfTj8E09D5?= =?utf-8?q?wuSwXM2DPZRymozjIq++7nQX5AkikCexm9GTSzOd4LrwaAAMLrZFrL5935LZoImjq?= =?utf-8?q?O5DKOp98g413HKrojle04QWj1VcD+/ptfQOgY9BvyxfHxskDeQnjFBf+cx3j94G0W?= =?utf-8?q?X73Dw94zJcBpVVgP4ErzLNojtQHkm0cFKONQEUNOGlJ2do5MNRJGGDf1JpVleDfC2?= =?utf-8?q?Fr3vIWiRodwhUa2n1xXMqDwi1g0smnM6Vif+yq5KuNo6RnuXk4OYQxcHjRDkPp0Sq?= =?utf-8?q?YayfCKqdeuPSbG9ue5SKdtlDLwfZPQcPhFOLwA+DHYjfwGEK/3fYa9fVxRaoAo5Iv?= =?utf-8?q?nOqPiOJx26k9bCSj+DO/1zYnKVsAvIhtBPe9XqsVORo8kh0yo00rtkEpbNBjEK+Aa?= =?utf-8?q?mmYDcgZHvtKCMBtw7FTpSSH8425QssAusuYOF5GQOvFZ8W8WZzaeT1wftvB8hvsJB?= =?utf-8?q?ZI7L9aXylIjeQy1mTvTB+PkoHhEZ5KfbEQ+eCdSpKndiW0rT8s9nyJKd6p7VeSI7K?= =?utf-8?q?qEsaoNDv8T3US6cPyGNbg8iaWBLFE+20NZXvXV25Cx0bkC5s0/b7aCzi0gE2KiLM7?= =?utf-8?q?Lc4UpSOKIQBqvjihCksO+OBf1Ab3TUDV7yMQnNiqps4yrMpxOcCPo9IBQ0mLb3SKL?= =?utf-8?q?MAAxJmt+GZ1RU6peQSNavGXE3wMtV1oyqFkraYWKZ10RroiXKRy4EmuZzNqJXY+cM?= =?utf-8?q?to4FR7AXeHjYLGXbiz4VNvAbB6/pVjxXIGwUCMe83sHU4uAGQYUlGuwh/3TYTuoY1?= =?utf-8?q?/oq72PQjagAah8Fio3iwEd9teOV0K8QcMKGo2377rX3qMdVvonzqejW0mg1ndvrCk?= =?utf-8?q?Oqxmmiqz/GU3Jmg3Vs/lqWH/04PM+wcZ84mHDtRYojLpmu49GEED69/D7iMUbymWp?= =?utf-8?q?10erQAxSuX9lTH7muIRUCBBxSt1Y67zdnsL/ouP/M08l792Up1KhB0YgrDPsAmJkY?= =?utf-8?q?+tq2bak2LMfHvoUap8cDopR0bwyaQ/jngaYFJ8ONz7GEomTcNu3UiyZLFwP6HWW20?= =?utf-8?q?52QiEaKucMK6YMZs+5ujbSnWjHFZwRW/1celaZECaT7g2MQooNA2Kjie5pcPhDUyw?= =?utf-8?q?rVvGInIQbk5HvG0iBIjhLyNASuoSHEtH3RzRnBmS4Ub2iIC63DBopmZ/pvypcf2cD?= =?utf-8?q?kap6cTGm1h7houXGGgNIHYKeD4LNVQA1d76nOIBIFcyowmRvNqGnLxCeLmyAT6h3W?= =?utf-8?q?UZMyuY7OnTJhSxvUs1jDeVXU2yYcgFbgc4nihftCjd1fl37Xvq36obIkG2+EfuD8M?= =?utf-8?q?B/65AYy5tYVI/MDunytDjelFG7iO47a6QAQMfnjcLCWggrfmndhlPIQc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GaDTlf5kEvRtKnAhRNgLca6eZdP1?= =?utf-8?q?0uINzJw7I1eFH1b+6a0255OiPAnvegtov22d42A6bm1hE8NsgXmHjGjjPnFKQTAFO?= =?utf-8?q?qOVwwUYtBcOJcO6rLN1SJBUYEbgx/lU4T84tF024Xjp7KAqsLzbN5VEAddP0DtCis?= =?utf-8?q?g3g1lgzQoJWDbNP8jg/iD1LwPzgHfRA03m1/Yo9Km04GJnlqOEWqXnddS+Qd722cm?= =?utf-8?q?Qb925Z2E6xKW0Dvt/fUNdZwIpAsJVHlwRC/GXLx/VB5XdHVRWl17fR5sCwxlqq4k+?= =?utf-8?q?5F20vKRCmUI/nd33sk99aKGFIIUyMT4BWimDahYHq9VgvjCkOex85ETYAKHEy18uh?= =?utf-8?q?U1ScF/iLgdBd+Irpm3W24wpC1z+47CR/LxD9vL/2N3J/obfLrfEsaMMfZhbLWjGfj?= =?utf-8?q?idJk7Qi8MhfZjQT3fUmYWP9OFzB7uOpN1LwdRGDte7YxKtmHyrsduopSnzifaresl?= =?utf-8?q?Ay1QKIrV1DRl6JmzEhzPuMuxMLOwQtPjsMtNfvmwJUmqY043gwOeJft0y4t1mb2+m?= =?utf-8?q?7FJTWLn8q3u0pV/0ghdiG017ve9ErI9WURFyC2W4Mgn6SLkLtRlapKkz3R6bQqtnF?= =?utf-8?q?5sj8m9Q/9YiFz0jx5s6/SAhaTCy8U7+OU2iHBdqbmv17Q5BIiFwun0IES7u8Dq3Rg?= =?utf-8?q?TsoT/zoTUwOdOk7dxNzY6JAx+EdvmMnP8g5bNjUTEz+x8rnRhx95VQf9KtRwFNW/d?= =?utf-8?q?+I9O/k8IZFCCq5CfxI4H46T/pwJ7ZXYEdtEZPgwpw9eaGmbxUiCwigods7A7y2JGW?= =?utf-8?q?hWwlAmnE0lq8Avofod5QNw+qvaXx6aBfoPFpqg6sA9d01odG8PNU1X8+aY3+oRen5?= =?utf-8?q?MONslKHYZ4hfIaqtwAR4SsSd5l7hSnzUEFsKxpHW1WF8cXLHh/lviWLwb6W8hgotc?= =?utf-8?q?eX5ZRDnelSDN4P03ulR9zSFo6zofk57QY6elwEEZbXi+PQF4EMc5KpbhcFgKPf5BM?= =?utf-8?q?C/bONaTyTJRCC14rDPGtVp0y8QRtlx2zfn3hBsroUtLe+JrT1WpWpxdkQ295uD7qy?= =?utf-8?q?D7HF+ywJzjbMyrZCpBS/kmnD7/pR2Rh8jq7tr1ndP4c3lY6v2KzPVoxkhM7YzNUEP?= =?utf-8?q?ts5p2ljm8xz0A47iVBLg9XfjPBbMzohyeSlHFsfsk9x+D+hk79fipBZVs20BMnfPk?= =?utf-8?q?bc1Kegr1UHniZQmb4IFjADG3NgWpp82Uo/KllFQiOD15rD+Jm3sSdTrRaICKnNJix?= =?utf-8?q?pTlMlKSynNvzCs62dvciKpSVKfqc3U1juX9sWp0Jc99sVOK3J7of6e0g2wdWYildP?= =?utf-8?q?3CY7cNn4Rs/Sac/h1S0O5kP8pvI8DEqC+KMSmcGTzt/457cn4ikrpXzGwoXUf/cPz?= =?utf-8?q?Us3V+Hp0aL0iId5U9ZVgBznIPXnsT5Arz4L7q/QyriFflWhfyO3kaVIejRKNBPpsF?= =?utf-8?q?7QVmcM8zeX4Ti5uJr73NH/iMF0dtrKMd6adFbeMh0BRbOK6R74Q8jJgvWka1+HJxJ?= =?utf-8?q?csrSd5msLmssklpKDX8WPn+ollzIf7JRUz6CxJHjUInvULH7+aTOeQ/3zzyoUuSI3?= =?utf-8?q?gnMabyiQmTmK?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f5ee1a4-bb1a-48ca-a0c5-08dc6c3c23c6 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:14:33.4684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cffexWyhFxcbCs7yVHPCRoKq8Hz6oeRtownJutulL+N/e5mtXIytW8fqu18Jm+yYgRBqEfJGqV/mzLUkkQYPDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan Reviewed-by: Patrice Chotard --- drivers/pinctrl/pinctrl-st.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 5d9abd6547d0..fe2d52e434db 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -1195,10 +1195,10 @@ static int st_pctl_dt_parse_groups(struct device_node *np, struct property *pp; struct device *dev = info->dev; struct st_pinconf *conf; - struct device_node *pins; + struct device_node *pins __free(device_node) = NULL; phandle bank; unsigned int offset; - int i = 0, npins = 0, nr_props, ret = 0; + int i = 0, npins = 0, nr_props; pins = of_get_child_by_name(np, "st,pins"); if (!pins) @@ -1213,8 +1213,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np, npins++; } else { pr_warn("Invalid st,pins in %pOFn node\n", np); - ret = -EINVAL; - goto out_put_node; + return -EINVAL; } } @@ -1223,10 +1222,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, grp->pins = devm_kcalloc(dev, npins, sizeof(*grp->pins), GFP_KERNEL); grp->pin_conf = devm_kcalloc(dev, npins, sizeof(*grp->pin_conf), GFP_KERNEL); - if (!grp->pins || !grp->pin_conf) { - ret = -ENOMEM; - goto out_put_node; - } + if (!grp->pins || !grp->pin_conf) + return -ENOMEM; /* */ for_each_property_of_node(pins, pp) { @@ -1260,17 +1257,13 @@ static int st_pctl_dt_parse_groups(struct device_node *np, i++; } -out_put_node: - of_node_put(pins); - - return ret; + return 0; } static int st_pctl_parse_functions(struct device_node *np, struct st_pinctrl *info, u32 index, int *grp_index) { struct device *dev = info->dev; - struct device_node *child; struct st_pmx_func *func; struct st_pctl_group *grp; int ret, i; @@ -1285,15 +1278,13 @@ static int st_pctl_parse_functions(struct device_node *np, return -ENOMEM; i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { func->groups[i] = child->name; grp = &info->groups[*grp_index]; *grp_index += 1; ret = st_pctl_dt_parse_groups(child, grp, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } dev_info(dev, "Function[%d\t name:%s,\tgroups:%d]\n", index, func->name, func->ngroups); @@ -1601,7 +1592,6 @@ static int st_pctl_probe_dt(struct platform_device *pdev, int i = 0, j = 0, k = 0, bank; struct pinctrl_pin_desc *pdesc; struct device_node *np = dev->of_node; - struct device_node *child; int grp_index = 0; int irq = 0; @@ -1646,25 +1636,21 @@ static int st_pctl_probe_dt(struct platform_device *pdev, pctl_desc->pins = pdesc; bank = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (of_property_read_bool(child, "gpio-controller")) { const char *bank_name = NULL; char **pin_names; ret = st_gpiolib_register_bank(info, bank, child); - if (ret) { - of_node_put(child); + if (ret) return ret; - } k = info->banks[bank].range.pin_base; bank_name = info->banks[bank].range.name; pin_names = devm_kasprintf_strarray(dev, bank_name, ST_GPIO_PINS_PER_BANK); - if (IS_ERR(pin_names)) { - of_node_put(child); + if (IS_ERR(pin_names)) return PTR_ERR(pin_names); - } for (j = 0; j < ST_GPIO_PINS_PER_BANK; j++, k++) { pdesc->number = k; @@ -1678,7 +1664,6 @@ static int st_pctl_probe_dt(struct platform_device *pdev, i++, &grp_index); if (ret) { dev_err(dev, "No functions found.\n"); - of_node_put(child); return ret; } } From patchwork Sat May 4 13:20: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: 794666 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2041.outbound.protection.outlook.com [40.107.22.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C4C83AC0C; Sat, 4 May 2024 13:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828512; cv=fail; b=G0fgLjKR/eRBHNDp2CJhIIlUW41QwEHx4ppxzJ75xGzUpRI4iSagfCVRObl1mZ43/yZvMtrtHptmTKixxqjcQ9H/8xyaK3LpnPp7nukAPAsWSS5Zsw/tvIZl6J/u+Kle/3DHPe1T5hJipPady7W+FIPKjVhl0xNhORhxT2fqqYI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828512; c=relaxed/simple; bh=E6ik9M6/qhOWxdXMSi5wfgwa6MozB3Zte/4KB5unPbM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=fP07JKr0G6x5MdEAKWwKd2aFDmDHYhhmSY+4FfiSdFlf+d2q1Mx0ZG0tiM3LTQVIJ/KB/I+VTpl3MCqEJSXw07r8UH7dcDj7mroNWzKJ4IPEANfO7OMYJ2DOd1HkcUFYYshYiuhu0BVgmSFiY3nl55jkusOI6YYnha441jO/vS0= 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=lZr7eJvK; arc=fail smtp.client-ip=40.107.22.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="lZr7eJvK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWcs9F6D1cAInFj0HNId55OgFiP/mkBRJdDBth1QPgZ5CaKgqIAALcgcQA1NjWptsksyVAzXuhsB3we/2egExl9uYbbVtaxdsq0leD3umqoNBu+9Ccxb8izBxX0JQ5w2zPGyFCIG9XcR9h6EXqpY9B2EPYkqz1V/CygsdPAe63ZvpD3Dk8JuG9HlU5X2ruOSETUaCKiZQEW253cf5Cl9oHzq5xhhjeYZR33/Siq5yx3CO9DxCQUZN4xP9Uos93z0tmyzcRg52dcbHPDW2YDrx6viOehHk+dnvXdGsJS7iqL209vw/qHQhIAGk6ML/9vKar82r7wkfCYgoO50+FPaUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RKzscdFMbKHIkbo5TBU/zyPoN0zmGs6d6fVNhcTfxjo=; b=h5aiCFA3yIhGGeDVFZp9kTNSwyd475ryEOK/SwQEGNwyuf8nAUKXiAKpeWOtGrkrG/DAkGmwU0FmaxJJ/Qh1ToPDh8oAQCYFNqzdxmG4x4XkI+CnQsToa3zZzW0z+Y/5kqztve3wax35JxlgJWPRQn4Cj1p84j2V3kd47RIp/pQr40bX/BY68ySZ4z7ZxdMDbCFd8EbpPEOLzCm4qeSjfrQeVc2esgF6218qpIGtcad4RckxyhOxOnng93HiR+/Vm/o3J5TAJEiDNV0Jwip3eEaq6gcIi1RI6108Cm7yMH84PCPm3puWCkSFF3Q7LIEUKhJ6cEUQ7cK9iu1lQSsOPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RKzscdFMbKHIkbo5TBU/zyPoN0zmGs6d6fVNhcTfxjo=; b=lZr7eJvKLCQzJZDvJgt7Naxc5QoUcJvqDpm0lF9CZdP2zjbsNCbQcGc2VU0uaTeQ1RX0b3Mq05FEoza+cTb1C87bIBo7Ud/6+Gotll2gHMQo0KA/svrXB2TElm9iznEQIx28QiSe8Fzb0dRRnqVsvZ9l0QoJ7H4RinW3AYeTC4k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:15:07 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:15:07 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:08 +0800 Subject: [PATCH v2 10/20] pinctrl: equilibrium: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-10-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=3196; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=HA5FdeU3k8hXGIzvGdYVmDetKxvVIH+CQmWTQZMAMaY=; b=5/9X9Qk9v/w+LR87FogVZNrWJ/LbCFJXvedVd7p6cKDdq763RoRF3HqVmtqSayI+ZxqnUpTVv 9nppgP1puY4C3uChQOu864GCcusz2Mno4rh5TLaHidULc7StN8ugZY1 X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: e5a5311e-56df-4041-119b-08dc6c3c37ca X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+e2HdoprGVrzXrmOHx/a9GV3vTDOPXH?= =?utf-8?q?Zdz6s7oS2f+/3S7ypA7czwD0e7r4deU+DWrrBqaDsAMxOzpVpqtlnNtAIz9L//lSw?= =?utf-8?q?jjNq4tOtk8KgzZ2iMxAqcG0gGtAH2hu/oxs8lRrIG5Ppm/zi6Nn7xNtmkD59eQjM4?= =?utf-8?q?8X70cHa6cJp9CO5dlqGMdf7OwtZZuyclij0oqgSHOho+XRynK4fQaUTX1mC/z4PrA?= =?utf-8?q?aR7K5aBQEjUSoMoee1NpafJXpxnplDnmQj5OETVRUoEz0M8lr9DZDxGXZ4EPcPuvI?= =?utf-8?q?RPSDfzPinHtj66PGLVPdHesqztTwII3y68npDcqWPmWbufwzXyKDg0m6+zyrturdy?= =?utf-8?q?F9JEQJen9xzLegGn3XoOoGWlpyoNsXRUjHAjh0X71MoGYAlzqDwr8r6d+OHO5cR3p?= =?utf-8?q?ixmH+kvVxacd7pauFij76vFIUysB5siUkFocDTz9rUEPIqonoeeJ3e53EU6N/6y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Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?188QvLyzi8N8AubEdh+Jr2QYA6uS?= =?utf-8?q?f9m7n7AMlXqW2RPxpbqfdFqSv3hqKvNMKJdy+Gn4oOi/sq7N0T9l6xBI4obziRTv/?= =?utf-8?q?Nhqmsfp4VWzxmuOY2VdLUA3hO9WdpYBcn/y6xWdroq9O4RGs7WOmEF22MndyPG1b+?= =?utf-8?q?mspjEBltzQExwSPXsLXwtgy3gqzNrnvBxQux06D0GnADYY52ST+xhflF8hrrsyqdV?= =?utf-8?q?CWaBTywTJwzhtf+sYryKxmnJTOA/A21uWZ6t2Q704WQhx/MbGwbZ9HUn761lvGA+f?= =?utf-8?q?dekB77d+FxH5WfXbLSgB+if8HuaMASlmjZB94QDR8nhFCYX6Gbiv5Am+jwwUrJEFE?= =?utf-8?q?c3EpxZ/hSg0vxMfUkph2YFSb37o96iZAXSIFkkvlit02FkuvOq0VgpanvJO+tOVou?= =?utf-8?q?lxjY7UMZLj409kwwmtwwV4gMrVKaZ4CXSQpr6idDiOYKxfyFa01nNnIlAIYcBP3sv?= =?utf-8?q?d3f3XaA5ZlqDxsRN5xCtb45dNcen1sap2lP1bkPlLyW0KrCYQd93K2zHsCAxoERaM?= =?utf-8?q?rpDwlv1w13SmHmBK4J9OLNgeV2mxAqcdj/doyhxScCabxHWWMYQ97CkRm4J5z7q6p?= =?utf-8?q?OHCiLDJL2UxQLizeNuAr/Nwx/tuhEMz13OQ/ZtaVRqwqJjQZH7GZHDVmKc1tanKaU?= =?utf-8?q?zME6x0HZmxVnIRz3mwQyYizGdGq2SEUFR2BHznz9r1TSZCH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CrossTenant-Network-Message-Id: e5a5311e-56df-4041-119b-08dc6c3c37ca X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:15:07.0565 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tgqzsjFOhmoOiJr4CQutCoVr54qf+mNdPaAiocqwbFYANx50RD96f41YT+/5iD2RuPK65b/qDDXMDb1ZrTn3Ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/pinctrl-equilibrium.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index 6e1be38865c3..e727257bb697 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -588,14 +588,13 @@ static int funcs_utils(struct device *dev, struct eqbr_pmx_func *funcs, unsigned int *nr_funcs, funcs_util_ops op) { struct device_node *node = dev->of_node; - struct device_node *np; struct property *prop; const char *fn_name; unsigned int fid; int i, j; i = 0; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { prop = of_find_property(np, "groups", NULL); if (!prop) continue; @@ -633,7 +632,6 @@ static int funcs_utils(struct device *dev, struct eqbr_pmx_func *funcs, break; default: - of_node_put(np); return -EINVAL; } i++; @@ -706,11 +704,10 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) struct device_node *node = dev->of_node; unsigned int *pins, *pinmux, pin_id, pinmux_id; struct pingroup group, *grp = &group; - struct device_node *np; struct property *prop; int j, err; - for_each_child_of_node(node, np) { + for_each_child_of_node_scoped(node, np) { prop = of_find_property(np, "groups", NULL); if (!prop) continue; @@ -718,42 +715,35 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) err = of_property_count_u32_elems(np, "pins"); if (err < 0) { dev_err(dev, "No pins in the group: %s\n", prop->name); - of_node_put(np); return err; } grp->npins = err; grp->name = prop->value; pins = devm_kcalloc(dev, grp->npins, sizeof(*pins), GFP_KERNEL); - if (!pins) { - of_node_put(np); + if (!pins) return -ENOMEM; - } + grp->pins = pins; pinmux = devm_kcalloc(dev, grp->npins, sizeof(*pinmux), GFP_KERNEL); - if (!pinmux) { - of_node_put(np); + if (!pinmux) return -ENOMEM; - } for (j = 0; j < grp->npins; j++) { if (of_property_read_u32_index(np, "pins", j, &pin_id)) { dev_err(dev, "Group %s: Read intel pins id failed\n", grp->name); - of_node_put(np); return -EINVAL; } if (pin_id >= drvdata->pctl_desc.npins) { dev_err(dev, "Group %s: Invalid pin ID, idx: %d, pin %u\n", grp->name, j, pin_id); - of_node_put(np); return -EINVAL; } pins[j] = pin_id; if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) { dev_err(dev, "Group %s: Read intel pinmux id failed\n", grp->name); - of_node_put(np); return -EINVAL; } pinmux[j] = pinmux_id; @@ -764,7 +754,6 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) pinmux); if (err < 0) { dev_err(dev, "Failed to register group %s\n", grp->name); - of_node_put(np); return err; } memset(&group, 0, sizeof(group)); From patchwork Sat May 4 13:20: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: 794665 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) (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 5FE383D0D1; Sat, 4 May 2024 13:15:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828545; cv=fail; b=cmVs+NTSjWNjcHNAVOZjEJ7116eiBdKJLGfk6ShxrV+uH9JpsZJhl6qBjj6Pxch70aEYB9EgsGgG5kSM2X295vXX2fz8ZhX2N/tOUZdKYcRwYVgLmJ3tY9OItuPj6ksret/TT/U6l1vZB3kAUn7xSfSF1pDZ2OwP80guYnDZxuU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828545; c=relaxed/simple; bh=XjYcrC4knEYcZi59FiMv3CxGYKeUFr0HCFF+UrzXVqE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bNPdy1MrdJUKSoXP+ufOKTFu23TBJotMNVff8jCHciC4Tf4jYg+fKFQrDgJljd/20o+RKnITkEVINLrOEJJVi6I78IW3X0YmFY8aAobSEttKt2da2AQxZ1ALSJ/rJImkVT8Wh2Gmj9CgmE0dDlT09LgOi6GLQTLQ4Jv1v3KsWRY= 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=ikUa133S; arc=fail smtp.client-ip=40.107.22.76 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="ikUa133S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W13wp9FiM++nWc+Yz28yg2bbPZLLdw+WTg1bDgGDy97n7my34QTBMGJm9rCBvzp1jMM40UEGyYOCjXD0zS8w/4qkYpLKQvl7qMriD27ylLz18r1NRpGpx71+GEwMlRijcmKKUhs+CFXmH3G9kKcmBss3HTxz6j5/wfn2/ZkDbfipOOFZwJudnMiD2ird4Hc/j/vk2HMY4xe4rTH60RivfIHTmI/7r/gxMu5AU+cvfzkbp3oXgi+gdfEF2NaAknoNou+/0PzqNZ5+f40vNXUDVNCCLF71gCdSTz7Sj63iiXWC0PUSOU1MYg18Pk0DfHCpTkaY8eI6SEW49xo2CPrxGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=EhXMCkb8gOkREMgpBl9dMK0MTGtMhyMCwsI/DCmdxXmz2BiDju4e0MARf+kdgnef3ekgtf/sA9wJjhLkLd6Woccc6Qi0oJ9qXs7HxQ4XHHn9TeSdhapuG31Hto5GwfCrDrrSFI74qAb7guux+hptHu8hvQZKzhaSYIDPhsgyorjn8xKgNNXFlwfRhwKyWTt7SG6vfhYriDHOeo0SOkJBpHhlAi6OWt4yqsUYKvHFcL4PAVylfJghDn6Pv8pNNg/UwTdNciF4jQVyFOU6oSCDIwWY4aCHM1nfV3820Dw/nCDJc4Pwz1nHR6zgMJtCOq8jckdo093BlwodHwDiJ8gSQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lfJwrgHZf+RNEj6PZEelZwXcext4Fk8ZGEAWxpPRGZk=; b=ikUa133ScwGjkZxB3mOk8JOHeMMaVQC05IL6z7ifMBDxhZikG5oDN5sD5QpBRr4tLPYGOACUrjCuJdwC44Z297sorvsDzH3xZIa//z39u4jVbrh6HxrLaD6DnCKoTP5EFf6x/zLkmrhHCBDTN7wVZUv4UsoaReDqBrH4StYeQPY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:15:40 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:15:40 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:10 +0800 Subject: [PATCH v2 12/20] pinctrl: s32cc: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-12-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=2925; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DE1TsODFhZuLZm6pDc3wReEJgqgWx9DxsgygoDyK3OE=; b=4lPD+sR8+ZJDBmnUSGc4BiJR63BC+fsZ9sA6ZLC22ieCU5l/dWZtPjTnnXlLTXwDaVFM8DgGy HeQBDCN8beEC267VymO0c1EOJ0IkKry6T9AQEMkG8hUVyAvlluXu2Hk X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b200d19-f7e4-46c0-a449-08dc6c3c4bba X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xHLPHeyT9tsHhS/evDi8fZCDww+tj4u?= =?utf-8?q?to1HTTholAYP727rq2DdxLNgkcqFi/59blmwxIz6/BOvXWPV2ycpDCQm1xSK+Iq8D?= =?utf-8?q?X+DYcCDjvLJAMsgQUMWKczcHRzXcdej1jWL7i8pQpw3JfFtUafohOXft7RHp8daWq?= =?utf-8?q?jpbyZqUFePUkOTtUoLNNx1iXi44Kx5Ea0Z4+fSSgJl2vY7oTgz+buDy0hxeiw20mJ?= =?utf-8?q?ybXGouUnbH09g5jMdDaJTvCumbHu791ts/6LS3CUYWw8jm7qImXg32udowtaLQINW?= =?utf-8?q?5s2crBuYFbm4gNEA2gs+hLKDS1LBvg29YQgLZry4/0X11kd3kKfMKRvk6M0+yMrRf?= =?utf-8?q?u2ZSDT7nE467vpHo/tJQYhvsctb2lAOCJpmHNIDYpt3wXcZ8dZ4/RoTaq20Y/b2Qx?= =?utf-8?q?1wdsiqkNzyfUQUQsDMZNFHmwceE92+WsRBqwWrlng7kokqdz5CuC/+Cjz/e+9yCqq?= =?utf-8?q?BXoAH9IELCPW5k8KIWXqbn1cvc2FAa/ERdh+YOs7vm12omD4YcOXqSV3ySF8s6CqR?= =?utf-8?q?EteB4hZ4y4HZkI1G5+f0Qpy82OFqU0ZStdtxLgy6t+vLwW5E9gLlzUwxEFqJiuGyV?= =?utf-8?q?J9J6TlemQv+b7qV8QWQGDtbwOyVcY6NsJDnFdrZlDQzwAxia4VHedEADpWjGiKdka?= =?utf-8?q?1Nf4aJ/Wx/NNxVQXjeRivVqYNGW80WbOcscRN4SW6i7lEKeIfve69FTNhXMRl1g0I?= =?utf-8?q?0lex4fhywfo9CE4kODl08TzY5WgPf5o+21LFeCPpxD04HCF+bMkoUXjw8wWxb1o4P?= =?utf-8?q?AI0g6AgJ2R2K0/ZGl9w9i2QZibY7c1G+nXVA0R2k6YupCEP/Md6mI2sq0TTzEPMZv?= =?utf-8?q?L+LlLEkxGjS8P2fme60dUeUehoblHGJ3zxrjKkrxV55cPnM/a3NZja3JFCPcpeUR9?= =?utf-8?q?iotLGUTy2AEVMy7dSMHhb+2t7FZn4Q/uKMvaP7cVvobgPQgH88SLoiQHdsOvIBIjW?= =?utf-8?q?pJBXya9xbZsgFoRKwLck9jtVWPRnhkOccfjqPmMgfwHVKwfcznI+0idJCyqJfBZll?= =?utf-8?q?8K1J4IyzS8Ab5dPW9Rp918kZ20KdejwJ/d2VkL4WzJgzJ5M/4Y3Hu8WuT0TI8z2FP?= =?utf-8?q?0MJlr3NZS+WvP0lq8jH1FQlOOkOCq1zpSXTDm/ATzYikKmyW46qUkYLEdkadoRiuL?= =?utf-8?q?N0vZ3Tc6RgZTqWVr7QpzwIdoABFURuO/zzA0XyXDD5t0sAW8mrEjmmdOlMgvB9QlR?= =?utf-8?q?rdgxgfZBBXtsM88lRSfwClo7L44k/K9O+JwmNkdiqfB83hNugG9noEQf6tnoHOmPH?= =?utf-8?q?a1MXLxfOsewzQEVcIIGLgRsGUyWyLAPOzeLd8VCUWsMPdczJRUT9D+Qo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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LOnVVHZZi5NK5dnuSodpVa0m7E?= =?utf-8?q?sMcjeVYkw6ZWjC9jSk1o1a/pQnY3NZs2KDTqQRfdig/OYDQuyx9FqgWDJQih3YuUZ?= =?utf-8?q?KQ1AKwaiN3JkP9oDFuTaB+Uv+IKbAinY0ffRFvUKjGmaJ6IJIU4NL2ROYLfIA1Lpd?= =?utf-8?q?ER9QMd+0i6XK5Qtpd93p9sYvfqAksJd2XZyZ4jQ9zsCXzot7WyZiEjQajqvsI8DyR?= =?utf-8?q?y1DVInfFU6KeeHUbol9fPsqO4bS6901Vffqm+fGEgjaQIjvqW8hZ4vj2vGXeo5FRr?= =?utf-8?q?3yd0RUe2e3ppQCKSfXMO8HlqK/iAjBpBLWHxJ8mP5J5eE7gtjppgSVQjirfB5vHAj?= =?utf-8?q?n4FT7kjS9UOKr9EtG1UB+7Wcj/TFFQxnXPt0wMV2rdtucTXdQR2FNQxJEz016HwIB?= =?utf-8?q?+1AAL+0sv/w8SdfzXlVcdU/uzT5qDz0VZDINQ2aY9eIgxcxdh0loY+Oe9woI2HGd8?= =?utf-8?q?yJ56/ZBEBZGwiAoM6pdjQCTxfwz4pGiedZLPBQ07tek1dJ0R6mary9u0JrXRgs1gu?= =?utf-8?q?kzgSqvBxh+y8U1YBiujR15seBLFzV4/7whYjtpyTnS6w+YH7IZTWF+bHbc1t5M0BD?= =?utf-8?q?+l65BqOAE4sa3LZU92hdtX6giVbKnhZxvJbq4mHT4Q9AI9SmnaX+vfyGxGNZKkduz?= =?utf-8?q?NzMELAK2Gje/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b200d19-f7e4-46c0-a449-08dc6c3c4bba X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:15:40.5200 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kTB7cM73P9h5jqKaR9YGbwVTQwji2+xZXBGT2FJE8I8Ox6V09qZ1W0fqCU0ax8qp0sCNCd/aXZ64mGZHFKS8kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/nxp/pinctrl-s32cc.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c index f0cad2c501f7..df3e5d82da4b 100644 --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c @@ -268,28 +268,23 @@ static int s32_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned int *num_maps) { unsigned int reserved_maps; - struct device_node *np; - int ret = 0; + int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_available_child_of_node(np_config, np) { + for_each_available_child_of_node_scoped(np_config, np) { ret = s32_dt_group_node_to_map(pctldev, np, map, &reserved_maps, num_maps, np_config->name); if (ret < 0) { - of_node_put(np); - break; + pinctrl_utils_free_map(pctldev, *map, *num_maps); + return ret; } } - if (ret) - pinctrl_utils_free_map(pctldev, *map, *num_maps); - - return ret; - + return 0; } static const struct pinctrl_ops s32_pctrl_ops = { @@ -786,7 +781,6 @@ static int s32_pinctrl_parse_functions(struct device_node *np, struct s32_pinctrl_soc_info *info, u32 index) { - struct device_node *child; struct pinfunction *func; struct s32_pin_group *grp; const char **groups; @@ -810,14 +804,12 @@ static int s32_pinctrl_parse_functions(struct device_node *np, if (!groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { groups[i] = child->name; grp = &info->groups[info->grp_index++]; ret = s32_pinctrl_parse_groups(child, grp, info); - if (ret) { - of_node_put(child); + if (ret) return ret; - } i++; } @@ -831,7 +823,6 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, { struct s32_pinctrl_soc_info *info = ipctl->info; struct device_node *np = pdev->dev.of_node; - struct device_node *child; struct resource *res; struct regmap *map; void __iomem *base; @@ -889,7 +880,7 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; info->ngroups = 0; - for_each_child_of_node(np, child) + for_each_child_of_node_scoped(np, child) info->ngroups += of_get_child_count(child); info->groups = devm_kcalloc(&pdev->dev, info->ngroups, @@ -898,12 +889,10 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev, return -ENOMEM; i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = s32_pinctrl_parse_functions(child, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; From patchwork Sat May 4 13:20: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: 794664 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2069.outbound.protection.outlook.com [40.107.249.69]) (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 B2FA9374C4; Sat, 4 May 2024 13:16:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828578; cv=fail; b=Ge+Dl22efjfI8LOretsl/vWJ/Ws00AzEerRzGY5F+GqD8ukg/MckRXzUWpCViHqP9/D/wl670LRfEvD7uaU0otmLhP8dscXI67pDiCHCU+SEMLPMa3RDh7sDHFo6gEk8BDA6AUSJdIA4a9ZWUvapVXdQ/dp9n4nPLrW8Z129IV8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828578; c=relaxed/simple; bh=aGocML37yKFLTQmAgdHIf5uoWsvtHUPQJME8EyVoT6s=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=SGyCPYqe1yAKP1BNxwr4MOFzeDbgv1wTN5ltC/OkKrrUZfXwMstLD/QDQzTdzLJNsyCh7MQ7CfFC2diBhoZ8oZJr9Zus9Zb/7m3MFnqxGdy4ei+wVsNREbqRIBtu7L5xXIFq6CyNx5AlRyEP/YnvjkS+2oqyF1A8W+9xuReY5go= 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=LbykI/RZ; arc=fail smtp.client-ip=40.107.249.69 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="LbykI/RZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HjpbylIYacvnbNTWQP2eW4n5I4okmE77Ce7/Dl53/EpW4Yt8DXzAzkFvYu8UldsRbkKqZPe3VissAU7I5jfJT18hYiGAWBsdEdnKWAxcBtPOxibb3Uvon5JFSTkptfPnOy+MOP4npnLPhRn2tEFbe5z65Iz2iDYrAswN+z3Z5vb9513kV3ldW2CqleJMF/LBMywB+tgrfD1sGL75xCez5X2jjrv89l0qKlBZxw7i97RzX9mJjN/K+2COUQuDVL5mt5yS5gJnHUTzAtbOU9tYZw1tgYgDMOiZnkfllE34U/j8XoJKG2jhVj2zCGCbLpe2KUyy0a7olcgT55PALcNERw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=dqGYH1FwLeN/qpMQsYJ0OBQXmLTP3aJUc7GzoCCWjyJrF2QvI0uVycx7CRkHbtc06SSQTJXmiPi98aUf8gG+JmiOsOJZce7M9pBhnCR5rJYGyI/FtQTsCJV3takHYFyBu5OvMG5wH+3DxvDvamud9A2R1+Q2Ji6fZKFaCngPDKCeNqgasKOdE43yAK2dV8QO6XxD96iLBsLPosTkRWwlHIfemLah8ppu6psxAyg1SCa9WNfgotSaU2gMDmZjVlSeqadnP3f6fEMXWOQ2EwK9OVhXs0rWjqLeX5R6xyLhkLhONee/sWVU+hrlwhz8XbRQi4V2NZ2Z+TyEchh4//yPTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=LbykI/RZmuGK+O14E8wO67iqZNfdyu5EQnlofWQCNSbAHiStMpPWzUmxv9UiR5GbG2yCzkxFgz1NQ+IwIUW1ySOpuWD6sM2jl05iLgCGOtZjFpdDtSOXhpaDm8KRFQiOPoJLE8ZmlMC7w+DDbq97yjKsNdcQeIQlGxagDrmT7Ms= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:16:13 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:16:13 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:12 +0800 Subject: [PATCH v2 14/20] pinctrl: mediatek: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-14-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=2143; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=lm1PEdHATfoxwJUL9YMs41GxvVEK/pacMdZ5mWFlWX8=; b=d8MWpOtXKNnFGmfz1eHOooCE8YCLHVTyQNBBLhSiEJgr+86Or3+ekvXynCYNgOqJisw6NtlEy IWju/BxoMOfBW/IhPYIVChwIIYZ7T5qVjSiPvU1zknqEB2Ele8EoB2c X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: f321deef-96f6-48ee-0b73-08dc6c3c5f9b X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?sBBy3tH1CTnhRXWFHqlvHDLqUeEybf+?= =?utf-8?q?XjGP9ce2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?utf-8?q?M1swkDTnc8ksN8G6CMkKdLjhwZYhhkK9o/KL4sksqsqtnURIQwW66AJP/o24C0hU/?= =?utf-8?q?XfP72LYOLd2B3z4drc95tSXlUb4DGuS/mBR9PhqtK77dkvxKYhAJYgOiNh4KEUOsY?= =?utf-8?q?Gxd43X6tWnwdb1/3RcLPgW1Oi8JVCgIa/dZPfxmzGyZGDLmomI7FIklnSNvBR/TfR?= =?utf-8?q?K5iz/3zGIgGluc9pL4jhLClBmdHLWsxjQjKF06fRTeAhd8rqXvxpZeIU8PPq93j9N?= =?utf-8?q?OzwOZL3+dcuF0DjdkC0glVZqljx5EWWk+TxNknG7tka4+SM5O4mKoD4d/OU9CSELa?= =?utf-8?q?sQ2lD0rbVDL0/+UsSQgCajKGU6rXYHDJNKs5YiwWMmX573UXFdf1xAKQ8ve0aiP7+?= =?utf-8?q?TiHK3EV82NhhzGtWv3tRSsChYiiP4tQ4c0GA4kuFGTaAK4pCq77iXazs=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HX+iwCWM1i82tQ4cajtrqdLK22ko?= =?utf-8?q?nadUOj1OvTyy8DrQf5rJvIq4QvPsfJBiLYofc3jl2/G/vXreVL01pGRS7DszwVksG?= =?utf-8?q?7oE7+j7KzC4VmOdjg1Hr4SYw693F6pu10YJGzFMTjSV8I/Wyi1vmRehO7eQOFkYJK?= =?utf-8?q?jGzxhTVXztKKw+/tKGn4EiLUe7MGI7+VhhVgioztDZg4/yrN05wqUlxTgGe7xLZgH?= =?utf-8?q?EunZ72j0gMkob7uzZQ9+95vMisiOagUEKD2rlu+pCT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mtfmPWLHPFN7sJTjNA6D?= =?utf-8?q?Q6MV15kbM+1XLucqLGVK3lEzodrBtCYZLDCwwIz8U8B4rHsCq+VYmeQAfLUixU7FX?= =?utf-8?q?xsdH9RC6L0JoRBQvTGHwp8YVC0RgsuUQczsBS/mTEVukP16r2FtHfr7A3vVTfYjQl?= =?utf-8?q?Pi1F9Kf+yJIpQXrvtmBgYsAFE+lhDfDy7UhlmacyIl+N/yKIYQPjg56Gwfdh+hcBV?= =?utf-8?q?Np27DfL8hJXB+y+zktfxyUCrEs1mLzmIhbJs0bAnVNUTG4iUQaTp2tapmLLINnEij?= =?utf-8?q?axgG2RaqK7X2KcIaAV/GVn0CGYCXK3EBaOYfnF8C1XPqr+mQ9QCdNDLQt8yqi58or?= =?utf-8?q?Yx/yw0Ia6IEpAcUMc/tP3Gz4C1M1nuMRrPA6jo7vNaMhzuZCQHzRj7mJrs6vxwrXP?= =?utf-8?q?aA9fau1ED4Xn?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f321deef-96f6-48ee-0b73-08dc6c3c5f9b X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:16:13.8452 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lasWAHSEU3CxIZoEiNBOjXZT/zjQItAD5txUd1NRZGwJarmvJdg3IsFiwxyqubcEn/E1ytvCZx3FX7rxsZyRBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 +--- drivers/pinctrl/mediatek/pinctrl-paris.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index d39afc122516..91edb539925a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -621,7 +621,6 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np_config, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -629,12 +628,11 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index b19bc391705e..e12316c42698 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -536,7 +536,6 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -544,13 +543,12 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } From patchwork Sat May 4 13:20: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: 794663 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2062.outbound.protection.outlook.com [40.107.22.62]) (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 683B13C08A; Sat, 4 May 2024 13:16:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828612; cv=fail; b=PXToDImcbk8MwRhoWBoX7fM9CCtB5gRd5A8LBdiTMzR9Ee+tRqo1ZC4oyzdfKeu2+8A3HdkjkHY2nzksJcesVQoUehpBIYT+6OgEmqctl+DQirS7usoMJNDITjjcYfR6e7DKSffvSNDwMWe2LQfIzAgM0Gs8s8/lIda5hPkEQ4M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828612; c=relaxed/simple; bh=o6F5l9CsoiURStmJJEE9Qa953QXfjAQBUVSJDbNbaG0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=geURmRg8XFBO0EVXnNcrsKT5y4MR5R7DmKkoLIWttzEg9NU9JLE2eXO39gNtl5/dYg2e0Lt6aqs6ryzrmU0cQLODMCtVB3+IBPVXo6qKdRkwAJ5EuJNunqHxpelp+6SymvINNhc1Z+Q0V6Ed1+Z4OjwuLMuE+oNwx1nSjemp4fQ= 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=hkF9lq/j; arc=fail smtp.client-ip=40.107.22.62 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="hkF9lq/j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iq0+wWzoQ8QOjJwjhT3U65H2p8s/t/dew5fgj3ZBpZzUk94yZ5xiSQTXDrbvtCsvKitephcf/XzfQs2ZViYgQN5gfd6ViC1nVLrEVKjEmQtDI4l/MsJXIB9Nbl11lNRyFIUpXHNqe9487vJW2J0u2NthW+NgwEvEoDOzbc1p/zC/rNwQTER8ZCEnPsOhweUwo1Z3BsPvJYle71vu8RTC4FvzBKeeKBmkimz6ADvmiRhfBlwz6HKqi5qgB6kSQ00sLNpMBiuILfp4na8qWwd8okkSij5ege9oLWCgBwWWZ/mME405ItQu9locoPpASh1+tFLf8mTXySgGLz31lgnu0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b8YW68N9lyxeJ9/mVk16q9wzxsh3g7k9BYoR+TfhQy0=; b=UE4qcH8Qe+cAnvJzlJYA4nduogUPkrcB6BJOqMOhNnPn8IiDdbCGoFpdL4StqFnNlceH/+46kN2heoV8Vq8jSzfqVwyLVn8w8uLkokRQbDw5ny+DnsqRNsXWE/5oG93KFp0cxGHLmXyTz7jQsI39SL1i21jFaSrstmClmLbCn1LOH17wXCa18NxKP5h8/5EQNSax2tXAEda3a5T/G/Kh6h0hC6qMrJ8I6Va0KrnV6MdQLiIl+CqLLuJf8YGyrg1b1QKAcDuVcD0m13hywuqt9PIJ141rjv2TbAl4BdEMo/W9C1KzPRsnlAwdGNZLXQkgsy5U9DBnPZpzPCakUyiaIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b8YW68N9lyxeJ9/mVk16q9wzxsh3g7k9BYoR+TfhQy0=; b=hkF9lq/jMcSmd1vDCP4Xw1FUFal2vtMiBcdMIM9IGtY/RbMqABtrwAJ/XD3hbLK8tTye+IspbuC5y1BpSRyaRYHzAlK6rsUAqHloELbRn+VX1eNkANyQqyLBPRR0toDsqQl3oXPWoUwPEZdh+ye/fqC2fSv8iNNIsw0PwMz2xQU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:16:47 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:16:47 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:14 +0800 Subject: [PATCH v2 16/20] pinctrl: bcm: bcm63xx: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-16-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1176; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ngb8bjYWoY2vP8GroJ6WPcYXu1rPDt13jwjXmDP0P84=; b=DCvLS+tJSjIJOYzv5GBcRPWdyszwIStRArI44CNxG71LlT4DW0wLaiJVWa3krSYbnAQteIYKQ axMlCLkIflgBmSjBIiiZAA++axwuvzMqZXOU/It10tJ/dOb4zf/rLxO X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 039ec075-bd8d-4c85-d9a6-08dc6c3c7377 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/7nQeMJU5DmcMfHEXPODtBRXmEHbvVq?= =?utf-8?q?Py3cUP3+44Y84/4nQL5tdI2ZUgK7bGjIk0MiRheNznJrRDEjITgF/Lmn4wbFMdWBR?= =?utf-8?q?QhA22ez4SH4hu0am/8TEUlwMjc07vWUAOrqbG7LqKt8kda4aGupmBMv1ZOr3MvjfH?= =?utf-8?q?ptAKRD1DHsVcpPw8FKUmfQjp3O5P1MSyiLfupJMEbxcSeX7R5dz1w5y8OoxM0r1Zp?= =?utf-8?q?Bq59dhzwKL94jB88jY/DIWRaho39gWBwsuS4xdRvP/b1Or3RDRiZ6QCzlSa5rjkfn?= =?utf-8?q?t4BjjIZ1QSBSYZuvkca18PO1La20nXBkw4I7i3i+4yM3xndClcCoRzmEShr5tuCE+?= =?utf-8?q?HP5tDNExXbJEEaa/Al6Fx66nTGVriSkwuzL8VoLyDZoVG1CltZidFFg9SUgcAYlqk?= =?utf-8?q?miFum4jkNqndqyv93KatUvkIeTLSB5iE8aNl6H0tH5udDzPbz6Od8aOrgDqoYm3I1?= =?utf-8?q?uarsjlufPxe3agGWc2ZVilLbdNjxQHFBR3y5+7ciVd9QSvrSt7h3ir41LNxQ95ubx?= =?utf-8?q?qQrDQN2Z35LFwPOmTSJur0SSRLcQwVl6ROHqVWjU4io4d2HkuYcLEOsuSuI90Ufpp?= =?utf-8?q?xe25caVkC5FV7KVufuln7prQngKYr+grZoKiyQ51CH4gH94vifvFS7+67wqaeYCBa?= =?utf-8?q?aWKbmvJySvXc6cQpY53Tdf+OQMMUfcWP4lFpY6PDPGlqBFvLdabxiOwQ1y4h+BV6W?= =?utf-8?q?wD2wsLT0fWV+U1mn9876xTBvVxx5M2bo1Up17hThSCDswuzrb3fxXVLSYlFEG3CGE?= =?utf-8?q?Qll+K6aMOrjr9YPaNKJnjWDcwv7pkTkZLDQcZLFUVzoYR5YzyLnDJ7QyFnoWAZHsZ?= =?utf-8?q?lbgD508fJXeiSSk31+oejzSuEARae9rs54oDSxUv0baS+zS25G5S20QNB7BOLHnsZ?= =?utf-8?q?yCB54QZNvph3lFE+EUFpy0BNj5/RBhxfgUUc8rlFf+4uZAzk4O7lR4wcIUV6XB5OU?= =?utf-8?q?Fz/OOPzuaiIeSlT0nxNM/a4Q+yabKC7S/6PXTYEVriwzHst6Yn5wnWDO6VjrkGSz7?= =?utf-8?q?tQNShBp6UlvC6mosOMbeR0pz+THLevcut9DRuGIhzJdBofM/ltO4eoTr4tHMj+0eC?= =?utf-8?q?hCvJrJA417rf8JkkkG1t7dr25o+G/ZIQaGZvDc7smCWVq/K9haCF43nuNzA15PB40?= =?utf-8?q?7PKFFRRkDOLnXCMRgDz/HSGftI+wcu585dD34ZMiRp7AtZMC+mDZlPdSColcJ/4sG?= =?utf-8?q?9BXLPcvUXzQsKwUJCwkO08YaTgfI5O68z8KjpoEGi1UtIi+OXjPCzgqXJhk6RsSMp?= =?utf-8?q?vuQCowYUnktsfGC6paVwwYhmH4hS17ihsyg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pGqNSNdOHCOW44dy4E/8KywqNsmV?= =?utf-8?q?eRvA3TcYNxK3TYMlKe6Zt/HRkKvwmGAjhoeCJrl1yX9ccLgS1x0EoTR+D7uLkK8SN?= =?utf-8?q?tBgfYMTaV5IAE5CmkLRXbc0tXqJgMKspw6OUE+MZDEx6HnZaIt2h8q7z4SDfg5g7N?= =?utf-8?q?8Pr1XLEI1ONubmZje/jyHYqDNNge5ykZmzo8NZntKdG8oQWtUDUhHxz5LVR/XI7Nx?= =?utf-8?q?0vMtMCZklJGdvf1zGLvywdPq307Y2yTBGyVVagF0K/EBUfFZmkhgWWwdiS5Z7RXu1?= =?utf-8?q?OSd+jx+9RP5s+hObmdbOXoLLKeqvlHbirRE9IYLXMYqHO/b3LvbdQQjEm8a2vETG3?= =?utf-8?q?L1ELMOu94B66VkJrGFAQ6EltfGm0ieP2K2BKU2Ml8UZPYTJzHhYFpAkp7ZVk0Oa46?= =?utf-8?q?6wt+ZBm17+BlYxIuKBkHFo750frYtqyn/yU/je8c/MU69QC5H3hfFLAX4bdpLcpFn?= =?utf-8?q?xNtC6b1XG4nA4iJYvFeWIqFo/gE+vhEIrefuN15VUcvGeprC1j9BrCaD19A94V2+e?= =?utf-8?q?5s5seg+k3N4zIneXXHBbs+eW50idFNxWM96ZPNE+woArII3j2MId9+Fy162xnYoVz?= =?utf-8?q?oxXCXcGkKAItURE1jVZ7w3MQPNzOMY6Lqi8f74QHxUtPt7b7FTb4UHZbujBn0yB67?= =?utf-8?q?2dtRCHQ9BeZSF67b+HQOi3j7HQdXqk6VoEgYH3Gd78KSK8Clx709i+PRGv91c4iIu?= =?utf-8?q?75HBRNjhkVOtdI7UlcIfkoTdfqaO1rbOSjQ8rO+VG6pKFdqkQr389U9/+nP+FPcWg?= =?utf-8?q?c/wxV+9l0FJFFath20CRj2D1bCXA7fCdbYeRhOikC0TXGnzai1oHrmrLb+miV994S?= =?utf-8?q?eTxA25w/KV0Tnbt5bygrYAWZuWM92Vobq4OxotL6DZk5vWCojPnH6FRVIdbsAvj3W?= =?utf-8?q?vTG14PdNTf5IkjYnq7FdJOMrrVBMM+ScxiEKZWtdWrUJDu+AzM1qalqnO3kthj2w6?= =?utf-8?q?ytWu+8yTyhe/n3qClO51blW/+4MoicEFMFAqRmNFxGfDOT8eNkT4gO7ldEkt9nL9z?= =?utf-8?q?Y4rGHUcV4lfZZug32M+u/LWtBbGVsTcxoh5vuHAj6/ZgvI53LwS1EHOyl/uWXE4nU?= =?utf-8?q?hUF+s5CN28t6PmuDoZTJTpswoeUxLiMJYPeyYue0ZPCkcalEgnkmwUJMnMYomNv5b?= =?utf-8?q?o4ovKIw9GaoeI/64NrCbMO5YBDJJYRsF31lMYEfSljNcxuRAUjLsf3K+499NVesNU?= =?utf-8?q?QWRfnibHFGDRLDhbmGZfDM0cJPufIXwzDSxjimTkOWcmuJEhIoCFiwOkGgfvI0Jwe?= =?utf-8?q?AYDn8pjQ2xIESH/2TD2F5IY30AGkZidjiWuYgi1z9KGg3Oa5S00amnBXFNSZM9gD2?= =?utf-8?q?YNT4ssxs+PYsTHMIQu8t1xA5dFMnuKkauWO/xuemjAKOsbeNuchE4bpbOLnsR2RSv?= =?utf-8?q?g6WDWVW3CFv9jH5ds/MVjeXERpODpXqL6ufIcNCd3mxLu559wz8+NxcdFtiB43bIZ?= =?utf-8?q?MOeZmOfKklXxniTVR2AGCXU+1uqepKaX+AcGr+fLmG21jzRcuq60l3l98y3cuPmFh?= =?utf-8?q?HCzZOaoEXeOt?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 039ec075-bd8d-4c85-d9a6-08dc6c3c7377 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:16:47.1839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: shY0dafUZUsi2/PfSPmiPNkIGEOpXTthpisY1rGu+XtACuv/H167vsA0VUdr90Fmv7gkwOa2dZP59lS30mxyRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c index e1285fe2fbc0..59d2ce8462d8 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm63xx.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c @@ -67,7 +67,6 @@ int bcm63xx_pinctrl_probe(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct bcm63xx_pinctrl *pc; - struct device_node *node; int err; pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); @@ -94,12 +93,11 @@ int bcm63xx_pinctrl_probe(struct platform_device *pdev, if (IS_ERR(pc->pctl_dev)) return PTR_ERR(pc->pctl_dev); - for_each_child_of_node(dev->parent->of_node, node) { + for_each_child_of_node_scoped(dev->parent->of_node, node) { if (of_match_node(bcm63xx_gpio_of_match, node)) { err = bcm63xx_gpio_probe(dev, node, soc, pc); if (err) { dev_err(dev, "could not add GPIO chip\n"); - of_node_put(node); return err; } } From patchwork Sat May 4 13:20:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794662 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.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 780BB347A2; Sat, 4 May 2024 13:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828645; cv=fail; b=JqmKQOv58B4QNnn62xP3gFDKNLnGgfLPYS4Bp7YPPItZ7lVG1mxDV8e9N2mdQeD4IeykFxkmlvV4ZhbY3ABAsYxSt7n1dagC86gMJkHe8m08BhtEdHmd8PTAcRjqhRXoN506ed3TM5tT9ul7Cl8CebzoWFgdZFLMQkKxJd9FtMg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828645; c=relaxed/simple; bh=VIt+S9lqc+k4TIsuVnBU6FhhXcdzzv/izY3n11KkU7c=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pd58cPwY/oGQe9je8VcGC4xejWvuNNXV/AKnph0B1QYgjkc6lYawbkmacH4VDctzcmgu77wNB940BtHN4IcCutNQS5dQSr+Z4wwU0UY3UD/qkcIpCeEk1BYchJTU8iRf5wvAjxbDCoWpz5eBWyj5yZTdW4I+Z6TeTZ3XhKAjB0Y= 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=jqHBIut/; arc=fail smtp.client-ip=40.107.22.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="jqHBIut/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uit+z74daa9mOsT6ePUJ2VMAVskH21u3nzQSgbWmY66uHTJ/hJPh1jE2HKUZb6uVYEyh9QWswo0MpHO5IRoT3gaPUQ8ozqL+Zol0j8WJTB/1Bg9/eMtv3pEgYzA6jo96MlfZ6HRJ87eGzlxhc2oetuS3TMwOhqbF/52fIV9eHEewG4Rz/IO5TFnv8WDYQma1FaukRc7KZGSJD8jiuIt/olxWiHkrxwJidc6F6x/q7x+uqxpYfLP9BVTIK7jNmlsbWAdJ98bwwxslgbyXMhrZhGwr+AfrVapxsgbV3SzIiguWOuoxbpsm03n1hioZxn1LE/JYKOI8rYqMJ0PxPefLBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=OSk6CPQoV8WoO69chXXc/btdybtOIRVLJPiTTfEB5l1MdnqEtN958wiXrp9lYGxp9hIJpgEIkQqLpT0OmxHgBKme/YUWV7INO6IHFnNXbjPyMae0RDCRa/oTYCmWuj4Zf8oTzVeEPND8FPz7b0fUw+KzjMhbgES8lmowZv5ACW/WQuxDyS+LRkDiqyhLFbZZY7e45IvTmYRjZy6Qmxb8K2F1f3Ycapp56u4pSIujKebpsUkM9I5lNGnXlfQ96BOn7wba1CmZdyXzyZyiloWMV9OqB5IMsW31w6WPQ6K/ibTBWbm1PZVqk3VEaddsQbo6T9ynEZnv8miZ66x/pzQwZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=jqHBIut/ZxbfJT53SP+F1q1/5XOg6UM2ONcAdAT67c+od0NBJAE39H3VHJG1SWx0ywtzj32TlW1Fd/AIhsGyWwULIsjQ0WpPgHOiFzXGz41QPlJDF47l7uhM5BRFfOR60nmc3R4N2OZlOD9/XhRjUIgsj2lBom2qTdNGz8hJ7zQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:17:20 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:17:20 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:16 +0800 Subject: [PATCH v2 18/20] pinctrl: freescale: mxs: Fix refcount of child Message-Id: <20240504-pinctrl-cleanup-v2-18-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1008; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=n5zUltymbb2QT8OVUi0ykdiDnyL/KXFAnvLfuklG8sk=; b=VlM2s8MWPklorkSZy9NCPoYCC+X1qhpT9U8O+RJ4UAzCFrQN9FgW0mVCVJh3cOF27q65t8QZ6 Ls7HHept/5WDey6gNVcw0jH5LWh2wGBBfxXZKtcPS/ES2kVoImJ3XLa X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a333ccc-4d63-4645-7e99-08dc6c3c875d X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?szoXTRNoxTcuDANL/avvjllrPucT2s4?= =?utf-8?q?ub06toWixiLjN+2b44KXbOlW3Nz+u8zHbZMg9sWDKEOfCU0ZKMf0M2JpTY2qXe9PF?= =?utf-8?q?MNIS4VKC/JQmwh6fExGyi61fwX+tZISn+VbzoC42ZjUnRs9h/nO9aS/8o1j7PGFdg?= =?utf-8?q?0n4StYGT6GicheZg533jp7UQQYjzwnpcaW8JMdIRooDt8l6Ujb9VNy2X+eyQfoPYk?= =?utf-8?q?9H7tmU1jklj5+iFX21V6KQwtidvAbS/VPx+WYVPUK/Ux6gMDwzeTJsY+QPRwtv+XP?= =?utf-8?q?0bB9pKsWzA4v6Pk5sOQotfn/FJJ0aPluVp9CZSLO/Ou2pJrZfB1FoZtEZnDREyy36?= =?utf-8?q?rFhzefHJ2JPITpU/nOP2EfJSiyah/mISgByhHdsKE2znyU5Ts4M+Lz9hfXvrzx3sH?= =?utf-8?q?sYGp96Um0uF2rXiF+tMSXXLJr3eoReZak/d6mIWyn0wn7G4hwzeyflwTXztznUzHX?= =?utf-8?q?z9EJyyWHBwnF8ISUV1vOJtZtRYjLDyeTmZviWeWa8hG3AxjOTVxczouwBiA/Bmd5M?= =?utf-8?q?JKWYFUYwZIkw+smL+CWefpB10gGZBHn14wTe8sWn1r0giRPwe+0M5KtGVHa/e5il/?= =?utf-8?q?tMT/H6vFEbRquu+pspW7cQAcrBtGZX34echU2sGFaZAF2jFBe9mXLUp0fO9E9sj8v?= =?utf-8?q?p4ux43wqOUuRmx+E7dHjEgPHeWHIGtT6t2en8jFiJ3VIk5oAtyBLtrnPdrJH4Wsbe?= =?utf-8?q?xOvlmzYYCYLSEkrmfPfEjtMs8Ngy9sP11eg3+jzJfH4k9+2eZLvCN2EPqaxBfF042?= =?utf-8?q?fOe0786IbDXJCVe2i4lCqWkM7pwsqFIWNvUYThmYZwi4wKjB0fCqptKsxns215ort?= =?utf-8?q?QzgsWlopL0VnBegPQeaIol1xd1jJL1oWasZLqfuDUX/U7mLG5pFy1zLmVNmHGSV8z?= =?utf-8?q?gDYcFoBJW2zpvkb4gGyZNqZTJdWSskplLZerJxq9twepFD/gEfafzTcs9GzfkkFXj?= =?utf-8?q?s+TOU6I5uPfJrXVwhtci6Ix2M4LmTnmTR7Ypl493fYaGzHxTc5YawtYba1B6XmBQ2?= =?utf-8?q?DzcR4EQbE2+n3AkeFmiOqvb3IvtNavZjLsRWL6ePMU9gax3+IqRWPXgjzHj6tZiZt?= =?utf-8?q?MFdakBBdqANCtvCohpEvBzonGRq4V9fNJkbGulK2yvbDNYwFmTDmAK2h2sc4cGYqz?= =?utf-8?q?3IHxN8eR2mJZftiQk6MGpVahC449L/J0X48bS0VT0yOITtM57X0lhIm4UJZ8hFAwG?= =?utf-8?q?D9btDNnGfe2MNMB49VCjotHMYkIEw2jFFGOThW3A2paUeG9RQqJIA7lE5F525tBeU?= =?utf-8?q?dfn/NpIWiZKv4P8u89a1qenO5INjoactfyJKvsSx1utsUO2mruGz39w8=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZUY80xlmj6osCGxyuq9Ra/6hxZFX?= =?utf-8?q?ccuWxoOgkbJ8kSfExgOqKUHfvnwHXVggCv4fgloE/PA82vjH8+QwszseNicHJTtdv?= =?utf-8?q?mGmJy2dRCcWjOSaOniyHXhhgqEhM8WhMkZ7H9DcO8ux13faWmiwjNYoDOhHXi2aKi?= =?utf-8?q?D/orsO+qvhZd4e+MNJwzNmvk6VGSYgRnNQ7wwgaCLfRDJYe1hiqFaauKLJkxuRuBb?= =?utf-8?q?tL0yT25HZAllD+zT0ZijBMwO6h8zyreIAX/KpO6FP+AkI32lo0H5wSEq46uZvgKBw?= =?utf-8?q?DKwGVOWUsTvlPYr5Y9URoVbL86nkmt3ZA9RrTj/wgsTbvERHjjG1O/i6Yq3xmYCJY?= =?utf-8?q?EKaQo5CtkRoIfPF/N1XHZ5l4AdLWcfWmFn6iLRYNtucn1MKHi38ne08lUtmzfXdEA?= =?utf-8?q?/pjmbyhk9Kc4TkaaeBsYNQlzYkeGn9HNESff1ylMs8k8KBoZfNwky/XxS9i3cm4EK?= =?utf-8?q?Wv1TnMTbva4k0s5q/mejU7WuGm4dWj51aZqi8Q0JClCNT+qp4RNmxCpx3Uz15Wnvu?= =?utf-8?q?hXrIJN7Tk+cSQlvmT/eOpj9TKUAzgIsgbqIiGufBJWnfQUyg5o7Y/bi7CPdysh1rA?= =?utf-8?q?Xvg3BYJ74wMMy7Jdz9XaLuqwjOSpAd6ytM/dqieE9KITX1dAIY4g7Lrxlt44/48PJ?= =?utf-8?q?by1PYBs8uva+Zlq2sguSKtx4zCGJm05xMlfvhlZHz4ry07QQMq6pXKAukBEeX6n1Q?= =?utf-8?q?SCizhwZpP4AQZG9HLphXRvTCpIc25SR8I5aoaPMtocE82O7txVgsxGWdSb9WeoZyw?= =?utf-8?q?EFsTI/PfGGcfdTei0Mdg5gbGsXtdFkheTWkXiqf9fkenFC/JsH6OstibNGfAADKef?= =?utf-8?q?OZE/X5KLrxvQeIiM9PclyvJggZcBytNrOoxbmRkOZtpCwuDyD1nvfTq6itsfU+BUs?= =?utf-8?q?zDeEDQmzNGxE8nyTSCt8N6U8tsAzB+UGQAAWKPHHXtOkXCjIQFArqzpDaHZQ1CjHb?= =?utf-8?q?OOuaok45wgk1//je1n8UAdr2eCyWEdnUXxK5Itqrq6C2EC6xu7l9VGBEoJbTD1yoU?= =?utf-8?q?L3WBNCG7EgFMra2bvvUq3PpecLCiZ8CALjBUaSCrnc9lBU+/M9q8kP0kISRoP1syQ?= =?utf-8?q?lzyr2Ftrwp6LsT1BR+XySGCX2y9q2HU0leyZayg1HYhbthzK/wpJcYihFd2QXk+hU?= =?utf-8?q?3SECgEu7P6iX53cpvSt3b7KHr+cYQMc5lCC43kj1XOmSc5sxLnAKPeNrUXR98vNRR?= =?utf-8?q?MbcO7z+GUgsY17xrqY3nPGRj6PX1p/FyFFvNPaF60mJ//1VohtLDh/wzsD/khhwss?= =?utf-8?q?hALKYdxDm8SfJcQx7VT9H4otKNzQoamn7l13bMl6b+nU5Q7zFfnX0lgZvYTTosCLS?= =?utf-8?q?0XvhlO8FVqHQhAjImcillBs6TD/1CH40gy5QtKchvUvidQQkc05wIl9ehHU3J4au5?= =?utf-8?q?7cjeSQrfEcPs4UTZFL2YmhlX+YRsGBWeKcFIsOCUy2lha6EZirdV5m/OcbqWt0E8c?= =?utf-8?q?bryazPvmnBD0A0idvbc1YQ1Hb47JIKzErN1Vu3DiCu8U6e4M9X7+4e6Ap0jTJmqhL?= =?utf-8?q?emodOOEYN6aM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a333ccc-4d63-4645-7e99-08dc6c3c875d X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:17:20.5544 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eS0Hqw20bfQUZBCxvAY/jHXjr5fiJodXMP/iYb+b2NEaYZD9Se67ioovz8+ccXYKulvQ7D65SmO1VsXjEHyfdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done. Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage. Fixes: 17723111e64f ("pinctrl: add pinctrl-mxs support") Signed-off-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index aee70fa55bec..edb242d30609 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, int ret; u32 val; - child = of_get_next_child(np, NULL); - if (!child) { + val = of_get_child_count(np); + if (val == 0) { dev_err(&pdev->dev, "no group is defined\n"); return -ENOENT; } From patchwork Sat May 4 13:20:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794661 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2066.outbound.protection.outlook.com [40.107.22.66]) (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 1F92438394; Sat, 4 May 2024 13:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828679; cv=fail; b=p/vNYG+6u7IHsuuZYZGMx/RlfWfc1eNHhGZEuSZKbHWFo4PEiw/Q8Liz0xh+SFOieEGeyLjd4MBANNx4Ow386ChMXtJpF+iUd5i6BXl2fPUn8yw2QrfLM4ye+sU4WcCEOXd4RfUuRDQQ2lRCbOV65cX84lae1uxayBDfUlyc5c4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828679; c=relaxed/simple; bh=wMNSJkH/G6gb8vDhU37wTmbLXobqUGpvvFnYEW9f+eM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=TBTkh4ZMsufjGcWdgJWdjZL3icZnZmp7299YZ+XWNNjkThsDY4OnqiTK8WJE8IKTJKpWMs6rKsqFZiFrCNWYtObdMgeAvTDYnOu9EIrhw4uKN+X1RYfju6rDVS4VZvuTNshp/4HeeteUF8y0fs2Wx1J0Gf07t5IKgjNtFkmYZOo= 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=BiuzAJRq; arc=fail smtp.client-ip=40.107.22.66 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="BiuzAJRq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeqS3lzaTiTvvMpQkhxAqx5LXu9Qz5Eun3vOl5nnj8mwXBiR+kPagCszrMCqC/HX7ErnmtqmkeHTlsQl7mCDF5OUcE2weGzTeSDHfeYnp627g+vC66DWr5E2/g0ozE3Oxe3HpjuwAK8453pa3XLNlyrFkMhz1aWOVQXdfoJJSarYTNDNhZXlFk1zo7DHTyvhVq7GQc0xx6AOWV8BG2Z343zDEYH9BJMW4vx6fWZakzmjimLoG0RmF6npsV0ooZRo3KVzUHfYatmil55/XwTirR6IhZ6eddWT/jwf3pcth51hCFg9Nw4lxdARDPsLR4HOLxLpr9s9edGjfYIKroB11A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ppg9aWlK4+huIGMqna4KeQPNUar5cHCrgX7Io5VTsjo=; b=eSqoOAsUP7zY+Kz27f04NZE8iZsc0ibTh/UKOCUYR1zdYHH2E8lajoRSyA8sDy3HvYin2IPk9R9VINGcz+xnoU97GgyO8xrHjmxu2PIo0KvE6tC7T/CwSOswA7haahV0t3JTAFusYl7ZfoYYlEyg3x/jM8xnEE8NlM9isHl5oWn1cm/Ts8fvWezutcVuUjLsPXSXVuNq8PsDytUlaICnsw+GZuSTWAzjFVSBxhATNrlGrb6xEVrIa8kevPTzME95TFC+O5OgK9hFHWIPZQ0VjhfolUDqh/LI067mWsjVDswRfZ9stebFk4P+850KwVhkLF2pWkabx1CYbNVTUU8lSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ppg9aWlK4+huIGMqna4KeQPNUar5cHCrgX7Io5VTsjo=; b=BiuzAJRqpHcg55cTD7Unx+2M7N8+VFhoSv+0CWmFBcYl7Z/WnOM/7NK2dREH09pZnPG9i0D+o39Dt0+CWJE4qgWqLizCKQMOXCFo2BGb5flRUGdzlr/E+bM7i1JWwUDG2zPwHzjuq5+8P3TF0T71rpYbqr3BGQgJwdLA/S60Cm8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by AM9PR04MB8633.eurprd04.prod.outlook.com (2603:10a6:20b:43c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Sat, 4 May 2024 13:17:54 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:17:54 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:18 +0800 Subject: [PATCH v2 20/20] pinctrl: samsung: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-20-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=4267; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Eha3FnaEY3bzUrakRMW1Ov8R+kXDm5JzTBhq10KxbQk=; b=j1GGjC8jOMD9Vols6kLJMsB1llGpiQjkJR5IlNAnfWDcAKwLbiKZUAALPTehYonJf7lE4q/wH yzEqddp4EMID2GMdMRfAxpHQh4H/pYIY+KCEK/dlCVBsLbU5lsfKaOD X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) 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_|AM9PR04MB8633:EE_ X-MS-Office365-Filtering-Correlation-Id: 88a760b2-963a-44f4-0ccf-08dc6c3c9b5e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|7416005|376005|1800799015|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?AtwvJC6/zUrpSsZ6zKp3RcwBbFkQto5?= =?utf-8?q?L6AE6n7fLHXhWlTVvBXlqQu6ey92kjxjDM2x6zaWdrfLr8WKkayeTsOgVoqh2brSI?= =?utf-8?q?luqFAE2bzbEJvkaeiqamJf0BKG7uVIlqA1iKvMjiLn5ulU6KsQvwqbb9HeTQzIaYR?= =?utf-8?q?tRr2MT643v+40LE2QfkTaucI/V6tfzG9oIVMIHWg/OsPzrkkObijT7pGJtULt3A3a?= =?utf-8?q?nGnD/tTeSZWZ4tdKUc6/Fsva7IBp62fXzBeUzMC5pCBh1bJeyuOVSvI8RgiKn+cC2?= =?utf-8?q?vEdI1YsNH9oXrjp+soaLa8gYVaKDdHI3w1wOXm0L0wZXKn2a87J8Ax8t4jyRWExwG?= =?utf-8?q?gNiOp13g6iYTEAIAn/pfJ7OC/vSm1IKXiHpRzpIeU5dJ4I4/g7ygU19e6fOlyKmHU?= =?utf-8?q?HZOqyqFUJiHVkDn/viJ1lCe4/uu2r0cCl8BFE3l+vrL0ltawaAnOyvruXmoCYW5bv?= =?utf-8?q?04Mhew2wlAXkhqsLvYyvb9qX7EcMAeB3oVsFPoU/eM9Z+02mf8HvncLpjiNPJPcqJ?= =?utf-8?q?3usS/sluMKTQEyVHwqj0izuFZJpcHK5zIklEpPG3IJhtBUr5lTLSefj3SIqgqayYc?= =?utf-8?q?4wM4eKasz7BBCWpw5quPf3MKmONa8vmV73yYhzQ7vDMC7xrmzlSCOSck7FFvOMmEC?= =?utf-8?q?MxI4HnYfiJFxKNFOAa+dvjNOjeekWrKqFYzXJnMM7x/gTd4LaiVnayFiEmnsPP4dS?= =?utf-8?q?iMoWmZT7yRXr1pKSR05ynvCnGfeT2VQPTraGIsB17LCfx4TCGAwlIbbxmXyssLvDg?= =?utf-8?q?Ir51fep/uiPu9jlyHSzKsHTQowYUsF5OoE1y+NygCGLbwZAdfE/IqjFfxvcUhbRe8?= =?utf-8?q?3rO57uqkcSQlSJgpUPsXuhiP4YpPAgYRlTl06Es54OWICS8M9rWhCZWnXEtptSdLN?= =?utf-8?q?TxUfC4VwrzPzmj+qGG7ruFF9bTN7cKQWqJLVfMkT5h1jSdkQ6o2Fx3nSOQzJMxUsW?= =?utf-8?q?OsM+2vZEkKm5OTSapbLXQ5zPSnUUdYpATOr1XEMVBKhPEnX8K0fryBUqoTBJJBwfK?= =?utf-8?q?GS7gHC1K3ZkZkKoLeGxeh3B7unYuK1qcJ/IugwDeeCRKRjiy6O3OOsD49JjID1xZe?= =?utf-8?q?QK7swmDFxyGDsRgsZKFxPP1aux7aTgDc1+SSP7atsgUGTK2/pqGLpM6oReiJiigV8?= =?utf-8?q?DTC6qw1tWzlUFheL8AXq8rzInMEc49xSA0bK11dw/VUqtisClx/ysuZsJ+ZatmNCS?= =?utf-8?q?FjwgKgZl31cwh7qwWkUyQ+nyIvTtz3JGsda7UAV3tZnnHHzh8PL9SDhJH/ggGZPs5?= =?utf-8?q?GC+w/F3G9Dmi93I8Kjeo5nj42PJt+NXtAKdRgjYHq9jkqvSUlEv3EhhQ=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(7416005)(376005)(1800799015)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: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fgSmfaEbQLR5MPCtDnrVD6jZKzhJQ1sAkxU3GH?= =?utf-8?q?zpIHzFMwxxZhGco+jLA5TCvEOX9d06U1cRdfi1LRnKF/6+uXNClGO3CfJILtv/3cz?= =?utf-8?q?/J1pqLrrVzHZK1OmENOssnOnBrq5Vm36iHzClKCmISeY9uFN6DQKwuhgM458Ld4Ay?= =?utf-8?q?q3wsaXBvcl8ShQ4mQlg0TLxQY9zbtFWXXR5llQ27gdR4W1AuW199HB2CbHbW9xDFe?= =?utf-8?q?J76Bup4bL5/V8aIumPU3iH+7Pgs5fJAo5U996W91m9M1bv15epRv447RD99VFs4Lf?= =?utf-8?q?f2e5E7SQRHfoLfQWKwd8OQd8ZfmCajHnT/JhTDMyTYGgy2HmhaztFNrL5RLo9SgWT?= =?utf-8?q?e7R7NGvWNrC4R82kclbSn+o0oUghcOgK1MtbAhhqfQ66XCYNY/FAlQShIFhD0mZYE?= =?utf-8?q?sVbUjGZJPrnuKS6u/uhy4qrr5TvKhrRsKRKaLMkwpLTv6vzXHG/oOlIwU3fPZNRuz?= =?utf-8?q?vgWdhukf8/B3uCdToLoHPoI3FyWm7JT+tarGljp8HM9PV9qhtvFEE+1b+Mw+QQDJo?= =?utf-8?q?IL7IidwqP8XFJyQQ+RyoZs9Xx/wnogtYifPB1gbMPVR+A0XbFx8w3yc3vT6dSzgVS?= =?utf-8?q?605oxvK+I97FwFjovf+hW2FzdyFTqFZekOOqJL8KyIscdc3CnLZSj0sc2s3iOIgmV?= =?utf-8?q?Im42Bh4c/Evd?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88a760b2-963a-44f4-0ccf-08dc6c3c9b5e X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:17:54.1216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Myzq3/6MY/HfklO204D+tBTrg7YaOAS/vgCDdDbFCJdHIDCD0ERvNPhbgg//sC5GpTgalc5VpfcOuOy0J9z9lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/samsung/pinctrl-exynos.c | 16 ++++------------ drivers/pinctrl/samsung/pinctrl-samsung.c | 19 +++++-------------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 871c1eb46ddf..3775999536e2 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -582,7 +582,7 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc) __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) { struct device *dev = d->dev; - struct device_node *wkup_np = NULL; + struct device_node *wkup_np __free(device_node) = NULL; struct device_node *np; struct samsung_pin_bank *bank; struct exynos_weint_data *weint_data; @@ -612,17 +612,14 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) bank->irq_chip = devm_kmemdup(dev, irq_chip, sizeof(*irq_chip), GFP_KERNEL); - if (!bank->irq_chip) { - of_node_put(wkup_np); + if (!bank->irq_chip) return -ENOMEM; - } bank->irq_chip->chip.name = bank->name; bank->irq_domain = irq_domain_create_linear(bank->fwnode, bank->nr_pins, &exynos_eint_irqd_ops, bank); if (!bank->irq_domain) { dev_err(dev, "wkup irq domain add failed\n"); - of_node_put(wkup_np); return -ENXIO; } @@ -635,10 +632,8 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) weint_data = devm_kcalloc(dev, bank->nr_pins, sizeof(*weint_data), GFP_KERNEL); - if (!weint_data) { - of_node_put(wkup_np); + if (!weint_data) return -ENOMEM; - } for (idx = 0; idx < bank->nr_pins; ++idx) { irq = irq_of_parse_and_map(to_of_node(bank->fwnode), idx); @@ -655,13 +650,10 @@ __init int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) } } - if (!muxed_banks) { - of_node_put(wkup_np); + if (!muxed_banks) return 0; - } irq = irq_of_parse_and_map(wkup_np, 0); - of_node_put(wkup_np); if (!irq) { dev_err(dev, "irq number for muxed EINTs not found\n"); return 0; diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index ed07e23e0912..0d4d7ebf7145 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -250,7 +250,6 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, { struct samsung_pinctrl_drv_data *drvdata; unsigned reserved_maps; - struct device_node *np; int ret; drvdata = pinctrl_dev_get_drvdata(pctldev); @@ -265,12 +264,11 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, &reserved_maps, num_maps); - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = samsung_dt_subnode_to_map(drvdata, pctldev->dev, np, map, &reserved_maps, num_maps); if (ret < 0) { samsung_dt_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } @@ -791,16 +789,12 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( * and create pin groups and pin function lists. */ func_cnt = 0; - for_each_child_of_node(dev_np, cfg_np) { - struct device_node *func_np; - + for_each_child_of_node_scoped(dev_np, cfg_np) { if (!of_get_child_count(cfg_np)) { ret = samsung_pinctrl_create_function(dev, drvdata, cfg_np, func); - if (ret < 0) { - of_node_put(cfg_np); + if (ret < 0) return ERR_PTR(ret); - } if (ret > 0) { ++func; ++func_cnt; @@ -808,14 +802,11 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions( continue; } - for_each_child_of_node(cfg_np, func_np) { + for_each_child_of_node_scoped(cfg_np, func_np) { ret = samsung_pinctrl_create_function(dev, drvdata, func_np, func); - if (ret < 0) { - of_node_put(func_np); - of_node_put(cfg_np); + if (ret < 0) return ERR_PTR(ret); - } if (ret > 0) { ++func; ++func_cnt;