From patchwork Sat May 4 13:20:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan \(OSS\)" X-Patchwork-Id: 794808 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2040.outbound.protection.outlook.com [40.107.249.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45362383AE; Sat, 4 May 2024 13:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828428; cv=fail; b=e14jzCFZJfCE4bGMpbDXHtXxlIrE3zxhus/u1gc87zWOKtQyBL74vF/CMBTKKIhMUTcFbgGC1uaOY2L7eQM1PdfzgDUgM/+L8UJqntK8LZUNlUL0dhyiLLSzj5QRxeuHzxoDiI5pmgMnzwW64q3Ejv78a5Q8OFfbeBl0yH2OCpQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828428; c=relaxed/simple; bh=8+3VXwLUrYD3nDfOr7HntPuhh41zJEyci3faFCn1b9g=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=L/wk8ifc/hMxW94EZ2cRcMIiB7w3RTYlO4eCNwjSrL1Q3HjmkxxlfyoW2WvZ+T8Kd4f+lMMSmI10M1Mfg725uwnEWiHMQH13Lw5p3UF1VYP3HGWrklh0I5f5az/Bh8Sta6qy4f31dM6DkgASNdFwvqZfh10vDzLKyffccnuWN68= 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=NpK/lcod; arc=fail smtp.client-ip=40.107.249.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="NpK/lcod" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEjKrZo35vprb+ulRKgA5XEBXHoWfX08dfs+rfUGfxW0PsNaNSU9X++A0D91rq55txf6Zy4S4ePWFyc3OH82pZbecy7zdz7TQC7fBUgYQcgPAO7Q3IrNPuR9YSP7nw8jtNStd/k8cZXy7gFXjRR990xlCjeastrPzUx7wQ8z4Vyz2vO1Eq5DpKinHWAYdVbDIJws0noJf699InJsQBHFd9+kvwCiPaoFVx/lluCamNaECO4LCyNpV0YvyHioneC+69uXv90rVJuM4ZtfC6HbwLccnV8tt1fEXn/Z8aD1bdmXDcBmh0tKeQX9tGTkLtESbvGMP3WyPY5LLbLDbSQ2sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wlbn/xB/PZwPV7ROj5DqSEALVDss+DndXNnPfNwAESg=; b=IpRShFXqryoEfTWHOcp1CIk6OH6s0zqw6wy9MuhFPbdKWLEcGix0ULHFmGU9yaQCohNtVQtwHDMyceNi6KhS+hQpo/s+Chi4ZII9dJ2p8Zk/ItIfMODcyWvD4kQlaiFlSl237zSxkn/KWkkWUgbCkvwYuxDVH4d+f+IBu3BeilfYqQhoDFcEI4jfy1fVOvpPbdVboWQlXCIIMI4c37exFBI1IyMV4Rrt8At9gyOXWdHgvKk0h2ACW3ANF/2IWzzn+e7HI6zDdB6ZiqLI4NNUNjafCqWulT0cqU6iXvfYw1jgXJB83eb6u8Dvr1NOER0e5eLy1yDLjCIBwpzBP0E2UA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wlbn/xB/PZwPV7ROj5DqSEALVDss+DndXNnPfNwAESg=; b=NpK/lcodQ9pE5BbJNbhQk3YjH5Nhyb1JmDwtplCNwBMtXa1WcgJG0yq/JeQCSa8Mi+kNwkwFW2xk+0BZq+jFo54RLX+6FZWwJajiEHumfZuG9ozhKXVpQS9IfB03auLP+qXSrU6Nn0lrmX0rES7yPc3mbezMfUNTvvJLmgrVtSM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PAXPR04MB8174.eurprd04.prod.outlook.com (2603:10a6:102:1c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sat, 4 May 2024 13:13:43 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7544.036; Sat, 4 May 2024 13:13:43 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:03 +0800 Subject: [PATCH v2 05/20] pinctrl: sprd: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-5-26c5f2dc1181@nxp.com> References: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> In-Reply-To: <20240504-pinctrl-cleanup-v2-0-26c5f2dc1181@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter , Tony Lindgren , Stephen Warren Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1540; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=BMqLHOrX8EQjg9Z3uUGPLv8QrQVTIzjrj8QOQ3y5znM=; b=Ugm0fFZvckU11/gZlb9LPokzX1/XETwbD8kMAjOF5h1wfoVm6mH4BII4a8+jjdOKtEdnq6kb6 jei5lzvJulvAYZ2W6id9lnxq2Oa6z3vUfHWLegACPLLaaZYeJIhnMjE X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR06CA0230.apcprd06.prod.outlook.com (2603:1096:4:ac::14) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PAXPR04MB8174:EE_ X-MS-Office365-Filtering-Correlation-Id: ae48280e-1957-4ec4-2bf4-08dc6c3c05d4 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|7416005|52116005|1800799015|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?bTtQBfKR3SBxU7O1P3WWfDnxG6GS9bw?= =?utf-8?q?dG+KzRpG/0gpEG5tMsIGl1rNUJ7t2ZqspOGdvhppQZQCeOoIo2WqYtGW0b85MJG4n?= =?utf-8?q?dW6KLbWWwnocPlol9Y1ZO9Zx361MZI2JdPjU3F1nA4m8SDRKRK//MPA1XScbaK2/b?= =?utf-8?q?xb4iJ80gV1khof5CUTRrbEtztH1uZDjLfSJOhVULMBAb0wtay0pcHesFdopXWcQtt?= =?utf-8?q?DsMRiKE8PZWST1yR6SO/ihRRI318RXISG73K3WTzbcylFNfNOzq60gOlmQgtIN5Ql?= =?utf-8?q?mPCLk7Gf5FCVh9IcgsXCZPHvFyH12Uud0k4VdhDUc+Nij9Cm2m0lv4Zk6E7ZUx0di?= =?utf-8?q?wXAgpeX0AGKxSk9rhcmELmS1id5Zi8LzPCYuFxCtzvos65tUsDh4bOZFvrzaxKCKG?= =?utf-8?q?tEes1j/FrTGlXl2vn2t8VZfAIpj4dloiZ4cjZoRt96f6su8PwM0J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3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(7416005)(52116005)(1800799015)(366007)(921011)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+R73NcYL5H4DMT6p5S/gB9/+ixXq?= =?utf-8?q?oBsvtKLCSTNY5xSjApx9U6SXaBeTn3JD83fTAsO0u1wzCF15bC12UiOJm4JZJdueZ?= =?utf-8?q?hNBspP7q6bjnd8Ek5jgw5fAKUnNSMN4hEabAiXD4u4jmpLzqW3jV88oBANxmf6nRy?= =?utf-8?q?OjYxnnhFIK2YzIMD/kzfXClh80dFpfLSSBXEtHlqtMOMpWpQnFJJd8Fz1gXSbls/N?= =?utf-8?q?p0eZKJYTUU2TQyy/KvY1nyBxDlhtKFT3+jk405V9AprY/IoJV7247ki0JRJvI4Ead?= =?utf-8?q?J3l9aYJl/zTU2JBDHyRmUb4dWbV2gM04MWo0jFoYlOy7kqRgunBuhvjw8jm9FgaQL?= =?utf-8?q?9RDtP5otLABRN1lUVoKuYVia3dbCX8pRzQq8rb8aKibgMAzwwVphqNIlRorfC2Kxt?= =?utf-8?q?t/OxikNGvWFLCCq2Py+IIgBgBp0x/ntUcGaJCuD3JKuLb8+T5uao7PoHxokMRxL8n?= =?utf-8?q?4XBplgkJDtWT6ia04t23JWJJ37a7o89TFU1aVicBAkf9mlmvBcR6pYAabfjphzgtN?= =?utf-8?q?xInUCwlarbgOcypiZbgpxqdy2hjKGiGjfbBwy3ieOAqoZUDg8qHEBPOoDldQducyS?= =?utf-8?q?hKuzMBLdhi+0qK+No/QFTpQUu56irZn/uzlfrl4Eb+EuauHckrF3I+WVd8VY9kCUL?= =?utf-8?q?rTfVk9t3WG7LsCHuPtTIOnNS5f/bzsma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: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae48280e-1957-4ec4-2bf4-08dc6c3c05d4 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2024 13:13:43.2390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xBz/wo6jszy9seIjpFniB9zAk6LmJZ++0AvHsX+MUpveQib2IRf6H7bVmdHZ7jXUcpz7/Ua5/Cme+TomydhrMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/sprd/pinctrl-sprd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index d0b6d3e655a2..c4a1d99dfed0 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -934,7 +934,6 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl) { struct sprd_pinctrl_soc_info *info = sprd_pctl->info; struct device_node *np = sprd_pctl->dev->of_node; - struct device_node *child, *sub_child; struct sprd_pin_group *grp; const char **temp; int ret; @@ -962,25 +961,20 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl) temp = info->grp_names; grp = info->groups; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { ret = sprd_pinctrl_parse_groups(child, sprd_pctl, grp); - if (ret) { - of_node_put(child); + if (ret) return ret; - } *temp++ = grp->name; grp++; if (of_get_child_count(child) > 0) { - for_each_child_of_node(child, sub_child) { + for_each_child_of_node_scoped(child, sub_child) { ret = sprd_pinctrl_parse_groups(sub_child, sprd_pctl, grp); - if (ret) { - of_node_put(sub_child); - of_node_put(child); + if (ret) return ret; - } *temp++ = grp->name; grp++;