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: 794892 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-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_|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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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+ilHcYff4afOrwUp6YWTg?= =?utf-8?q?DeQxme9mvlCKQL8CkHdcGzCHlXVCEcZYUE4xoSReicM7NjDLl8sawW+mgIDs9Z1Zu?= =?utf-8?q?psJDwzINEu7H+I4WWYBcHyVL43Y8YJep+b02EGPKMFfFnEBGL9XiJnaJ3nJqR0Jnh?= =?utf-8?q?dNpkzMXvON2YYdW8cGiMOFLr8CR3APHQyLczUgY9vPT+x8RQc/XvELuMJCZV4xf94?= =?utf-8?q?RJdeeiM3lqT3HUWKikLq4IkpALhEnyXm10D2BpnlSK9tscWA4FQj4kuGcoBaWDx2U?= =?utf-8?q?kt/8xaA52nW5fdFLf4hesHpw2/r145Zu5uPbbJC59sW40DviJBnMZX8kzndUQuYbl?= =?utf-8?q?hW8SmzDs4ukZiVhN6zkos0XpW8K6SZLyH+d2DzCEO9iEov4XyCfrEYZpz3RyEPmtu?= =?utf-8?q?+R+FDP7f+utiAP3iqJzdGNORqhs4Hbtqa+FeXrjNRw1KGVuN+mzWO1sBnKLT+ONQU?= =?utf-8?q?gWf0yAuXK79I6hv9djfbS7FdfqnzvKthl2g0UONa8AEThyUNL62Ld1BEN1qWCices?= =?utf-8?q?RNbqPB+YcmQuP9yz4TZzDdTjOvx1ll0bC4KOjj1Cr1gCa2Zz4pmMOvLJiwgpStpnQ?= =?utf-8?q?Bh8f5qE+5BpymPD6QHFk8ROU0ydfKEpJK6HNo1zbXbbsW9iUCww2RMgMe8u63irns?= =?utf-8?q?mlR9Mj33pbLrp61jXy8vM7YCTSPk1L/npQ5GKGw7IdoIJFYx1rnqIigHTgSFcL1QG?= =?utf-8?q?MqwlDI+x4BCnZrMj61LTovzFczEyQdt5Tl0f1nmt9EE46ZYszGrL14QCKXi09XS8J?= =?utf-8?q?ZCXh/+RW0jJ/zRvl50/xfY6fRFLL4QL5CkJY+2CVP9ReMI/itAowgl34burFGMOW6?= =?utf-8?q?Im/NiGQskKAGTzx5Rcza7Q5yPH8GGPlHjWv54DiehDjfX3z1u4yGs2n+a5W+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;