From patchwork Sat May 4 13:19:59 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: 794810 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2053.outbound.protection.outlook.com [40.107.249.53]) (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 200DF37152; Sat, 4 May 2024 13:12:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828362; cv=fail; b=ue1H/68hQN7nZMcBhOYDv8soRpYjUQODBA0M8XXO010cmMJH7t3Pqt0g4b6OsXZXcTZ5ZS5JgxrJjyUakkJ3rolXUNA266WU3YT8Ilkk6JrtB23FKO5tQofnXkiXBjcNtIRkbXQLDHvT6/o+ttsSiNl9F+JenlM9ehX62XmJfK4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828362; c=relaxed/simple; bh=Ou336TSEbTPCZ/WIqf3NpyjX9m5zSkYnk3ABqYz5TbQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=Gq+EE5qRY9MfEawTXmHlDXYoWFvtPaeheyXgGzf82ctNzPYIgpZizoY0LfVj11r6IHggwjhjKgAmGswgyrnG+KLH8G3txDj9Q6y6EFVukeDbvRBxRaXR3vn1pCPyDSbuVtSc0gJrKFRB3LEhbdNbT2Vahh4dcSv8HVVWURElFEw= 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=RfoqmVxx; arc=fail smtp.client-ip=40.107.249.53 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="RfoqmVxx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UY7zlqxIQP4a0lCG19cd/h/eNk91MNW0MPe2ZEXbWeyKbOaQb3KGvf+59/GdrNKFsxHVxzxCb8V/Uf8FFYwBhH72xdJt3sChpofEmxkvAU0N9nkKXFTAiYKdKRFY/lDnzSv8apboekGYxPCa+idf62VEcif6Q6Sv40hsseNFLIsv6rz1I9ThFq/VLbo3jRCPyvocKVoVML/vKG8qI16hjeMHZi37KTC5SnTUsm8CUKCaVK21GYukGewBH3fWeKOxwrYaupy8yeZfm8Y4UQgxqB/Io5T2DLEk7APtUhnhlBi4ZeMMIkcTGwiBBZmVA7OLS/bhiHOELARH0HLvUgMqTA== 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=xnIztDwVNRck+xwGiauHd7SjHMFdl2QwKvaMCCPUiQU=; b=Cu6szOifWb8hjTpJcCl9o60zOxpU4DqihhS1IgLtrb8MeKVL61qmqkcltBXvJkxymIqirKaLM2HrK/740AOdGsNFKcxym0ykdWiuWjmz1HkRP1TeXAc8qdMsU+HYz2b7aKeNv1enyUAi2O5qXAir+uqujEdjcCqtC3eo7W4+PhvptLogY5BPAo3FuHHW/HXhSLlx9g6ZPcD9rYCqnS0W+g/7I3iTmAGj3648emQmGGz6xJ509iWd8qNkVCE7pQIskG35c1YYkLcEu5tgkz5BqNQzGbCU2QjKMkzDbM7yam4yc+fAvykWNg67LsrpXIbJr7EDf6+K0Lf+Tr299b2ieA== 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=xnIztDwVNRck+xwGiauHd7SjHMFdl2QwKvaMCCPUiQU=; b=RfoqmVxxKBchWsVMFsNGvdIgaX2urC6JZngbr5PBYllS2QiW+z2o7qS27p7FAN5YMpeaCiCi3gULtNf/zGv2vLc0YleCQvEoYO/xVFSZ3yKQb10r5mTJTEcprkBnZNntcov4lTcYOcRk6MmNLjbsHz86gh7c2WQZYn+bTsX1Qlg= 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:36 +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:36 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:19:59 +0800 Subject: [PATCH v2 01/20] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Message-Id: <20240504-pinctrl-cleanup-v2-1-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=2712; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=+OvVNjQ9hEJHGX2TTZXWfIPqFH/ASaiGPFRoyyD86ck=; b=wBwz78+ulysi78J8qrvqUz4DHAoNLDZSQ8dx1MUycl0AKWDH3Hh6flSWohonDhSJYkPD4nSLU q4z3mqBYnq9AJZKYQSF9Qw0Mfn/LYZD8v5fhhR/sN5iLqcismO0zG9m 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: 3a386a51-db17-41ce-fd86-08dc6c3bddc0 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?ylrGjuIJPqlksyumulYTkv74lzsB2C3?= =?utf-8?q?3S4VRDdKL9cr9KBrtmUsYIQvkZwvsYIB7q0ZOt6/URJvAwM7q7OCCcWDIA/LWlLYQ?= =?utf-8?q?iUELpYKLPkXu0ZA0VG+UqXcXEDKjtxbClyJqf34qxrs1Cum9b34Bb7q4z4k/CtPrf?= =?utf-8?q?i2/geuMm4Add0fjGCIYSIpKnF5t8G6HCpOXPo2MbfNzz7CoZGa/ePFaaQEv0eYANk?= =?utf-8?q?QONMTOofX7EiWGSy4DFCvjqM/cFCFvCTkZn0YMvEmRMPH5pHNiM0jDcf2NqAxU4Wu?= =?utf-8?q?RAkPMaQ13GsYdG2dYWkiLJO6QnTZcnO/l4zw00Uc5Iv1yd0W7CE0428pTZLEGdZAF?= =?utf-8?q?kaRr9BgJ36JzBJH/Lw8u1j3vQk8Go3RxntRyVxRJQQME2zyismpGrAJHgVYHQlKGp?= =?utf-8?q?d0zS511KXp65YIi2u6F1y4JyH8Vgbnl25AWR8WcHxdJlY8SfH1x+57FEgaSD0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ront-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?qUn6dpxX0MBL19yJgUlHqefCAk1O?= =?utf-8?q?kdM0fcnokGJfZiLC6CAtU+/2DQ/jtD99OhpqlP558rM67p+u99dBYJQ/tvPmmPG/x?= =?utf-8?q?tgCMrKwjkav7vryY6rVsrlOjelIqesrXSaQG4ttxZok5wjA3vatbQDqByvcYDC2O9?= =?utf-8?q?nFhsrZ8F2LjQJLEUA1FZncdxI7/S6FPOEMo14oZeYiOZ3Ci9W9XRa+sHMFSAlG97s?= =?utf-8?q?4+blNm2JFywVy+aD/D7Nlao1A8H+qQALbWf5XNMmne/E91ieGmCPcQjns8acFnHkC?= =?utf-8?q?fu70ZUudpFqNK3EWlCH+ytH7Cgi7/+KE29nNrLmI1VN28QXb1XQw5N6e35lNIkALe?= =?utf-8?q?ibtHCN/ea67bWyceLoELiAaAQdCmk2nCshWmG7kFksn5FgMkexRf1R8HkOOHNgSdu?= =?utf-8?q?KyW8PKwvPUh9FollodPeb6mawpiStcWrJnqDt9vVe75O38wS+/WWi0/5synm1Aa/0?= =?utf-8?q?DdzBAgsbJuUCnzTLGRyujNhtb0juw4yWiobJsdhwYvFb/lzT91jwoX3O5UJ3UbuIi?= =?utf-8?q?Er0fQTuuinT10Ude1pVxYM0SOnCvPuAGlbHofTm23tU5UYPQSWAGgxYMXQXG9e5sa?= =?utf-8?q?yPgttkxFV2pH2ly4AZnq2/OyIuzZK4REXwJ8xvmM/vNyGi3hkYEJZDGnon4EIM8yn?= =?utf-8?q?RcI26pho85OliR7XljJzQDCz1xDjx/muK+RZSuIivI5LssGJZTgG4O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-Id: 3a386a51-db17-41ce-fd86-08dc6c3bddc0 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:35.9937 (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: xkL1NGtmjTHzgUEOEpGYD3XConoiQLgB8vnYFjSMgVN5FoD8qaklgWrmfeCEQ+h1dWwFnYe/mlK+tvyurvqy8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8174 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()") Signed-off-by: Peng Fan --- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c index 040f2c46a868..1032bc9c36aa 100644 --- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c @@ -822,53 +822,48 @@ MODULE_DEVICE_TABLE(of, ti_iodelay_of_match); static int ti_iodelay_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = of_node_get(dev->of_node); + struct device_node *np __free(device_node) = of_node_get(dev->of_node); struct resource *res; struct ti_iodelay_device *iod; - int ret = 0; + int ret; if (!np) { - ret = -EINVAL; dev_err(dev, "No OF node\n"); - goto exit_out; + return -EINVAL; } iod = devm_kzalloc(dev, sizeof(*iod), GFP_KERNEL); - if (!iod) { - ret = -ENOMEM; - goto exit_out; - } + if (!iod) + return -ENOMEM; + iod->dev = dev; iod->reg_data = device_get_match_data(dev); if (!iod->reg_data) { - ret = -EINVAL; dev_err(dev, "No DATA match\n"); - goto exit_out; + return -EINVAL; } /* So far We can assume there is only 1 bank of registers */ iod->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); - if (IS_ERR(iod->reg_base)) { - ret = PTR_ERR(iod->reg_base); - goto exit_out; - } + if (IS_ERR(iod->reg_base)) + return PTR_ERR(iod->reg_base); + iod->phys_base = res->start; iod->regmap = devm_regmap_init_mmio(dev, iod->reg_base, iod->reg_data->regmap_config); if (IS_ERR(iod->regmap)) { dev_err(dev, "Regmap MMIO init failed.\n"); - ret = PTR_ERR(iod->regmap); - goto exit_out; + return PTR_ERR(iod->regmap); } ret = ti_iodelay_pinconf_init_dev(iod); if (ret) - goto exit_out; + return ret; ret = ti_iodelay_alloc_pins(dev, iod, res->start); if (ret) - goto exit_out; + return ret; iod->desc.pctlops = &ti_iodelay_pinctrl_ops; /* no pinmux ops - we are pinconf */ @@ -879,16 +874,12 @@ static int ti_iodelay_probe(struct platform_device *pdev) ret = pinctrl_register_and_init(&iod->desc, dev, iod, &iod->pctl); if (ret) { dev_err(dev, "Failed to register pinctrl\n"); - goto exit_out; + return ret; } platform_set_drvdata(pdev, iod); return pinctrl_enable(iod->pctl); - -exit_out: - of_node_put(np); - return ret; } /**