From patchwork Wed May 1 12:55: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: 794041 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2040.outbound.protection.outlook.com [40.107.6.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 8E1C922313; Wed, 1 May 2024 12:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567726; cv=fail; b=NSxc9AswQVno6u/cMnlmH1pS3AJPftiRNfpBdwGGXu1MKpDIHFxS6O0ztytxNE3HVgLc64uq2z/M1jP8mDfjjKz7f3P0AwFKfQWt3fw8X4kaFSeApSBvCXZhc7KCvX6cUSAol7F3iJOZhhoNlNx/YnSKd5pqeWDmbUo52/gUVH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714567726; c=relaxed/simple; bh=5oFMJzgmGVyaM4GqlYVEDeihtJKIKmnMO+5W0gXfuq0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FiHQe5Cop/XDx5O7igQn4NYjiAc72VyiDTSwX1IXLhYu0IyP8AyuD9icFxub85/XggFxa6mURif+Yd7GFFy8xgTozcAmsAL1mBARe0HSu0DSYMFj8lMgEEHXzpBwEI8jPGdNTDckLXoTDjH7RcDT/1tdVyx2NARqsUrMhU4GeX0= 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=avzeKvSq; arc=fail smtp.client-ip=40.107.6.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="avzeKvSq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jtGqZBS8teDf5x3JRMuyIEblZMUrEOuJmfQMDOrmWCiaMEHwmJx6SDzE2IkbdtpsRjRgUFyGUJ7obl+6lA2ByW6eOwSugT1uD7AzbTBm71claRG/5uPeq5i0/buTwnKGN0mb+ZXRGEAjM5nvYZGGAjMQSX0ecSWZRav6AvayK0rLYQUWTTHuJCdvK74YQmwVjk4TqH9iP2XNFWPW8qa7w/9MqNU2OS4FHif8XqPz8FGfIGD8wZDsir9X/x1DPQLJGKNr2YdCQghJHqAeVXdWrY3NP1Rqj5I5vajmm9QhOS+L/WMCNnjoleW+bUTUSjp4d8DeSkP8piDmFJ8XH7bOMg== 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=CqwszMK70eQVJEA6pKKjpRuI8VkEgByRm8NicNvuM8U=; b=jIF5zYFLfv4k+Ai4BLO+LbHzQhW6gxxMjwhEvjGyAgvljoPw0bzqFq/iiADMHLK4jsJXB8R4uxO8wkPQQnRgAywEDB65StlIBxnXJiaYZ864r28x5VGKD2VOJ4qzksNNGwcRXSS9gr+xbJLJqdSYcbRKmcpdBiDfwo6PXkGvd9jxMkuCD0Hlx8ig9ItEq2ExLbbVqIVWM0ULlWlqQRRSLvfix8dEyUtiaV8HcUHMFFa/yrTCBccbNYXllTqT24TURzkbXh18YCUQXbNkKy9m4JSg2WsVf+pFp/VvUoIoOgba/W8v3faUwG/qapcZNS1VQIoMe9pS1An8x4XWKVYPgQ== 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=CqwszMK70eQVJEA6pKKjpRuI8VkEgByRm8NicNvuM8U=; b=avzeKvSq4PewiI3jQVyUnNS8LbfkC+8WIhgG86jlQtI2C/xzP1qJwY8L2eqsK9cpfGKPicUA9/z0h6CY2VjQBPf10WP2AOYPRK855LWPn1ckp+OETvELl7E7KSKM0eGTCleUahuTQnaYodX6rkPbMm6ET+i9ZnqvwhihZFQdF3Y= 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 DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:48:39 +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:48:38 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:55:59 +0800 Subject: [PATCH 01/21] pinctrl: ti: iodelay: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-1-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=2618; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=pkkGggwje14Z0jtlI2/3mY9oSznaGYtjsjUTP2Epebs=; b=8nSRZH4j9ElQUUnrxRoZB0IvYaXm+wYHSYfUTORvK0TtdfiFHDiT/ysKV1+rzrNSC18t/cZBF RPqvUMxjmGSC+wCW1TMY2LOwrVvVWQ57ebWbTQL39dBLQuE2mlMTYN7 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-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_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: e10ed49f-d70e-4910-e729-08dc69dd05b4 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|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tZnrQ8Qrl4+9OrOWudSuOkWa0QwIxmn?= =?utf-8?q?8fVnWWsns5pJT35jIlJafpq/x7Oqkq9WjHs+MadS9O5xZ659BoVWoPFmgeSVpqFtp?= =?utf-8?q?Hmvdsd9DWCe0bWyasTXtO2+KDxxyRTbZJqmJrxLHp4DCVN4x4xpCWrA+iFcHQFDfE?= =?utf-8?q?NaWsAGPagYOIA9/ESZLRAFxr+ueD2b1kUPW0QG9irTFlYtVt4psvau+IBBY+TVygt?= =?utf-8?q?DrGvtLV55Sn4wraMavcpDtq11SeKCOIgEg9ci92CnxCfFl4awnoKISdyvTqcLlSwb?= =?utf-8?q?gQnIbLi56rd6pIiWOHamsSV1kjs+eBh4fGDxQk93JSRQAFeWMm1J2XF6u/Gp9sa5L?= =?utf-8?q?SIWQf5fnAUwPAHNN9ec3hRALSwuhKSKxFfYy+ouKlluTh+gMP4dtn/dwenvbvBAhk?= =?utf-8?q?K7Wyhj6rHshlv5EckFVNTtyRosOCGLon2UXFJL+w1xiViWibIf0GJTV4X6A0SvNno?= =?utf-8?q?d2TssVgUfRhMahND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LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR04MB9417.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(52116005)(7416005)(366007)(38350700005)(921011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?pgA33c0kX2IoJZDaLLDEkVUVD+kH?= =?utf-8?q?KZ7QBDkDtJfaIaJx2P2Xy3iD+sQvR21i/paUhwfokimF2RKXHVYV7Cw3sXOz3Lha8?= =?utf-8?q?TyoVqevCDTTQ7QxstJWsrdwK/Vq15OnF1UsJzuDePrXIRR+qTcxVKXaWAHKMDuXPj?= =?utf-8?q?yE4mml8xqIZZxHlbF+sniPH5Yjgty76txqjqwK9f2Ys7d0Z453qHfS2c7Qd4V4tJ9?= =?utf-8?q?2UIagIec3PgzX2ATRCZviZSVhSBQ7ZeR9dJHV8pipS8KLGbSTdqze95r1RzNWNm8h?= =?utf-8?q?XYK2hnxWwuwABWo6qUXF4+dbPcIPtrAxaFSJeixDM9SENDzIarL8aYddC9ad5DJ5V?= =?utf-8?q?niryCl0sYeHeCbTpsj362yJe56Yp3Yz9H6IH+RP6eiLd5zbTo819pmhDmWdz0ewOT?= =?utf-8?q?Ji+nxB4qkww6saVO7hEiyL8R6vWatMIzhheZOgy5Hb+l5MgIwKPYlLQx2/p7x0FQn?= =?utf-8?q?A+EXeqTGTBe4nm1zh/cvYhPH1R5wpY2zfzNgSVI01calc1sk9dBRL+Q2tLRgFvVWd?= =?utf-8?q?Q/r46yIwG6yZrKOLPom9itnC/oSEI+NIxHpXrTCUhqeA8T6ol+EUT1/lzhHk7cKzF?= =?utf-8?q?4WDcC8oRmurrxZmUDp32suo21ahPnvW/3H1yojluFU3MZfoAAxekCIAnCYvwt8jHr?= =?utf-8?q?qQZ34bYSZadYEG45PbCW/UM4p7R/PGjNFVpguHQf012fdD2PJK/2Nc8j28uHqIqT+?= =?utf-8?q?V42479bDy5Vyw60n2NaiSYTT8CGat9d4HU33TU9dCBvIBoGW/pGWpKAC/EYK+XQ41?= =?utf-8?q?T+QqsKDo+I7sLiUSoziW4kicuhX71WH5odJq++iCggek9FxJRDB9hpg/5Bha574cG?= =?utf-8?q?7VPjx7FOkyZvtyR99mVDdeh77r6nIGCBTDQIyL2Rcez6+VWiM+w5/B8dtE9fh+PwX?= =?utf-8?q?QxgH8ipdQlECVvwlgDp0Fpr3rotsYAL3DjXXvpdqIwCehc8CXC9lcLAtTCN7ftQIX?= =?utf-8?q?WaMugCclysqRnB9YX/AI+5K5Cb/3OMqrTXVWskMVQoN2ud3e3PkAdyyVgyw7LeyBt?= =?utf-8?q?DJPA+0og+7bHebQnbexERA+cQixZZphhx6oeKUE0ZypTZX9aGs0d1WBNv/uzkAV8T?= =?utf-8?q?GsARD8Ou2/HkAyoxDMGe/miPZnCyrqOLR/hCsH3TmEWYv0vhvCbQggTGevxc5XvG4?= =?utf-8?q?OfJ4UBEYsKlUWGBUcsdiWchFvDzXyJUeFgVfv5FdAyNGs/J22BxrpAl6zRdd9nI5z?= =?utf-8?q?yNqpCu2yzBcryRxWKik1Jl8d+avHP+bDGglOF2X+h2PVlRhMx2Nq7SsUvoWme1gt2?= =?utf-8?q?hEOcvO5kufvXTxd7+X9MnFX2+E7l6cTAOT9sgMI7L5SLKCsw7wrcXacyijAylS8k4?= =?utf-8?q?A/WvFHmGOnOEL9E+s7/kJNN7eB0FJJVmoawVd5m1qs5XZsVhTcP9eJePn7uSjxKEh?= =?utf-8?q?QwBnEox4zbH4lKXSMsRUGsTFUJ+7S6mK6SXBzBOCFiAVallvr4+ZK8A6K/Drz7cas?= =?utf-8?q?3KskeoKQ+ftQB8DSTFzlVNXa3BRDD7Xo7DIlSHUn0P9JfUbIyAOBdT+WLBIANIHa6?= =?utf-8?q?Wnmm4bUb6exE?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e10ed49f-d70e-4910-e729-08dc69dd05b4 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:48:38.6333 (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: MwPttC3uQZkaHlw2TbVQNdOen4gRwAJVis6AnSuWi9l3s9tg3ZEut0bJPfwIMBQ0BaFcpI3O3vG3HMTcJVR7yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 From: Peng Fan Use scope based of_node_put() cleanup to simplify code. 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; } /**