From patchwork Wed May 1 12:56:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13650586 X-Patchwork-Delegate: geert@linux-m68k.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2080.outbound.protection.outlook.com [40.107.13.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE8DD1EA84; Wed, 1 May 2024 12:50:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.13.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567820; cv=fail; b=YPnt39OX/YllkYXLqqgnY4OZRt/DjJzZIJIOpzelQI7fjz0aAfkRWoKu8bLqH/+F/ybUIeiU+spFRoVCyqAk+/+BVBmRSY3wdQzWYz5Fgy6DA6vZSIZ9xNTrwD2WHQDWJ9TbMgyvPh8/VIxEX7G3miNEBheGJKpLyk9ha92IVi4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567820; c=relaxed/simple; bh=OInO6yAg14U2A4TIttQDy/mS0VvP7xhIZA0f8KUS5dk=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=av7vuNgfoNBL2hnhXl9YGCnQJ30WMhaKyPcsftZHXEjWo6ozPGhWb8LcW7XwE+nkS9f0rfFfUXleuEIRMF9uAq7fpr26Lqb6+pC5wvIaGP+X/smQdqvDyoos5gnYxdBWwx9QWcf9V8rfusu5/GKb1sJo27b3yXLI98UZz66E2Hk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=cZipzCbo; arc=fail smtp.client-ip=40.107.13.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="cZipzCbo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KlXs0UjSi1vMqrsif1HGZWkYFRbJp5ptGqN01C/w36+72HjBo1F4BRhOwNNTCqOqaLZOpSKXfbliA+qkvsAU5Cgf35G+RwaQjNZYQ1QrkHVD5j59qsfoD7gd7Mra2rwqldL0Vq9DL2BM2QvnmbFfstGBhIzoxbMTxhTnsByiuk1iRa7ECKmwRW0DqiDf51lr81trGRfAsmNs6E4nscBqNCXL6i5N6SG4zQFlillgcg6oK+GIeb3H0eU6mlI9NQWpK5s5KDkt68OtZu+VYcizlAm+w2MGm2L87+jGm7fLQvQTzvutC+qd/JTm9bD8aYX6kPykkTRrv6jAir4+re4jbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=Wqps2H6ek/2E0xaTShqwFIZh5vfJN68YleAmPS73MD5W5SoVgwbAL4AsdVMD2Ydkp28DMxmuAyw5NMfP4rQSPjc2FGYnPpqH0300OrqSSOK8fpBYm09nBz0lHKj62F9ybqmYEhRx/7X0Hx5FM8I4lHVxeLYYfwXqVFoBOyc+QQOPdPjrELs1VlYD73iNLmfz1p9sdplARflJDGdreaDzKXj0/FBB5CaQWHdMw3B4raDm+5l1bu944XsKsoKkNti5vDonGJEcwcSr3LE6556bb6BoDbKrMe50aLUGzkBAL/OeyN/C2sfng1s7xJCIki8XRjPQp2lQvjWZOifuP06v0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Eig9P6zNNvksUOs0mChTICwLK4o4MZg7g2lLrYGu3MU=; b=cZipzCbowOFGsvyjBkun+Dm2DvrXj2nY829GzsOFOCWmjkxfTSDguNJLA3v/mcRAtzS9zlyPndCuiBgZWr+/h4CxGKbc3c2mh8+jqpbYW0tGdG6Bjj6iD241ieLU7hjzwlI4otXahO180IDEK8Qkn3NZ3I1R90+PNLttkA6IdwE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:50:15 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:50:15 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:05 +0800 Subject: [PATCH 07/21] pinctrl: spear: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-7-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=1599; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=gLxq6qceZG7Nsihhv4/AWrdppvVafau2eKIInT5INMM=; b=5hrt0gbxJJ7QqY7zWkD59XD6gGmBtnJ2Mk2mppbXKINjScokK/bEUlyDvxyY37V73GUwBmelp 8QpZLElFZ8OB/OjNAS53Kw/ZvCNuX3C/romIDSd8neQC4zDRgxkW5fM X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e665480-5eb4-4375-39ec-08dc69dd3f8a X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BSNAqcpD021rTm4/PGaEaMa7buoVUhk?= =?utf-8?q?6+sw+v8CdPbqnD7yq84d557KwnnMXuxiWEoNL6hvErOKXe/sVkSwId+qCuq7OyWF0?= =?utf-8?q?blYLxx/X1aciZJjZ9FO8tl9oEC5AIrcT6seaxhGfpiD7zNBcKlUcKd7ZJYhsY21Up?= =?utf-8?q?IcPe+JlDjTgit8mUWM6c7MzdQqbRsH/fupZhX/+p+pHbmnACYObTsVilFJFwQCp83?= =?utf-8?q?cL151uLDVmLCDu3iPh3ebU1+nthKnFbLHvkKw6EmcVJ+bqlMs2yFzXTpJuAhJxaUv?= =?utf-8?q?g2V4ng+bk5HajHWPuBPGyuMwEAAMRmOoerVOHshU/A4okiVDp60GWW3yXRWpmK5IH?= =?utf-8?q?hxgPwnxkdRvnYyfy0DmxyI4yKsSQB489mv+o6S8S/5ZLx6auZrPptl47rm5Pn4pXV?= =?utf-8?q?+jAcvQoZKy6S/SxMpFdhkX8kBIq444zXAaSZLzJskvHKN0Bn6epQnNJ6ZMLt8+gxy?= =?utf-8?q?4FIzTzS+6C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CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ipRs9/gpI3sBhxOLHJeN6WIezjBv?= =?utf-8?q?VqL2VpR+hDoWjylUgkVH1DC+EhT2xoB+Z83Kr7/KARkoChBfyGqVyIuEh1lk5mzOY?= =?utf-8?q?0fsx/7vTYQ2bWj/XevCRPeY1j9Ao/Q/tZQA6600HcMFwpwEjfi3zyp7us9q91fIN3?= =?utf-8?q?GzerPqTyFq1K2ZcZFIs2m5+vDhwcGEMawTMG1GgiQ1Pou79DGWV7C02at2bz/W/bW?= =?utf-8?q?dM46JJLITkc7OPrH+nV6xPG/Ai3s6YlZN7N0svcaxefgAkJvEjWA96toHsQGruybC?= =?utf-8?q?Z+lqO9AYE3BamJ1XrAjk5wb8aqrNXBxdIbANWMHg6WQFIGhBfhR1usgJOqVIVYOtY?= =?utf-8?q?JEHbHBPZePSTTBMtFk9nU/O2fvs82AzHA+j8daf/iVrAOjwvFnkFfgWalowMeOM+t?= =?utf-8?q?/9zx1xMa6tkVTWXv23BPhpNolo5sR8Q6veXhrr8+eOyZvbqRcEy6QRFVPwjnMJi1Z?= =?utf-8?q?2SKqxJjz0NLBXxGS7QAzt9NWRAnfXn1WimBKt6sbBEui7AZrAuCENZVM2QZgUCCPy?= =?utf-8?q?fBZo71QC/uaHOZXMBdLEvE/yO/9RV3CPIlUVVSxuQjJ4mPWJyQaNqqxJZIaciMuYL?= =?utf-8?q?pubu6TydMXSqKnN0VPSKiOEU0JqX8Sy7hxDdI1nYz3SGr2pZP+/gZ+Z15CIKPo0as?= =?utf-8?q?8yiINwkGyPvYSBnCxHsWwZMEtHvoFqdKSlW6rT8bFqB5Ed1b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-Message-Id: 1e665480-5eb4-4375-39ec-08dc69dd3f8a X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:50:15.5502 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XkHfKCLsyqDxegbPuqxBxgVbu73I8PVYwC7CDQNooBActqbhc11Njlm8wnVrI5roh5OyAWqtvP41o5HfZmQ6aA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/spear/pinctrl-spear.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index b8caaa5a2d4e..a8c5fe973cd4 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c @@ -151,24 +151,19 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); - struct device_node *np; struct property *prop; const char *function, *group; int ret, index = 0, count = 0; /* calculate number of maps required */ - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = of_property_read_string(np, "st,function", &function); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } ret = of_property_count_strings(np, "st,pins"); - if (ret < 0) { - of_node_put(np); + if (ret < 0) return ret; - } count += ret; } @@ -182,7 +177,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, if (!*map) return -ENOMEM; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { of_property_read_string(np, "st,function", &function); of_property_for_each_string(np, "st,pins", prop, group) { (*map)[index].type = PIN_MAP_TYPE_MUX_GROUP;