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: 13653920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61792C10F1A for ; Sat, 4 May 2024 13:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tyZ47kdOE3jKyguUqgBgrIzKfIYkAMAs/D6OaIGPbsU=; b=GMB0mkDv9zyThJwKTyWKw+fFI7 Y7/Ozd+9XdkADE1RRHoQoYdwFObDpy819oO2nZi+gsxKMxep16qUyNlJWmzI8NZdQlSpwGz1V/QFg XcaArndBTUVyBEse6OdTakWNRn/xa0d4wY7KopMU1S5QSDk8vvP7fGrhR9Z5DXxluxaPoR+xCk0uu WPkplf5t4M06jDU/8jiCw/GYXTBRVRLPV5bLQlNfjmByrDkrWR4Zo5OkoLbpr+f2BQJdrP7mX7QYS +vg0QRJtUDmvvwiKiBSGFIIywCrNSgGnN2urPnKbrcowMrMH1w5Kra5vqFAcEGyYcAj2gEaXBlf1l u46lD7CA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3FDs-000000026PD-1fqm; Sat, 04 May 2024 13:14:40 +0000 Received: from mail-am6eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2612::600] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s3FDo-000000026MP-3UXe; Sat, 04 May 2024 13:14:38 +0000 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240504_061437_253002_746566FF X-CRM114-Status: GOOD ( 15.62 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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; } }