From patchwork Sat May 4 13:20:16 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: 1974126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=jqHBIut/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WnqLB4ytYz1yXf for ; Tue, 20 Aug 2024 09:58:26 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4WnqKL3RwFz7Bqk for ; Tue, 20 Aug 2024 09:57:42 +1000 (AEST) X-Original-To: linux-aspeed@lists.ozlabs.org Delivered-To: linux-aspeed@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=jqHBIut/; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=permerror (SPF Permanent Error: Void lookup limit of 2 exceeded) smtp.mailfrom=oss.nxp.com (client-ip=2a01:111:f403:2608::600; helo=eur02-db5-obe.outbound.protection.outlook.com; envelope-from=peng.fan@oss.nxp.com; receiver=lists.ozlabs.org) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2608::600]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VWpBC4SCVz30VK; Sat, 4 May 2024 23:17:39 +1000 (AEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uit+z74daa9mOsT6ePUJ2VMAVskH21u3nzQSgbWmY66uHTJ/hJPh1jE2HKUZb6uVYEyh9QWswo0MpHO5IRoT3gaPUQ8ozqL+Zol0j8WJTB/1Bg9/eMtv3pEgYzA6jo96MlfZ6HRJ87eGzlxhc2oetuS3TMwOhqbF/52fIV9eHEewG4Rz/IO5TFnv8WDYQma1FaukRc7KZGSJD8jiuIt/olxWiHkrxwJidc6F6x/q7x+uqxpYfLP9BVTIK7jNmlsbWAdJ98bwwxslgbyXMhrZhGwr+AfrVapxsgbV3SzIiguWOuoxbpsm03n1hioZxn1LE/JYKOI8rYqMJ0PxPefLBw== 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=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=OSk6CPQoV8WoO69chXXc/btdybtOIRVLJPiTTfEB5l1MdnqEtN958wiXrp9lYGxp9hIJpgEIkQqLpT0OmxHgBKme/YUWV7INO6IHFnNXbjPyMae0RDCRa/oTYCmWuj4Zf8oTzVeEPND8FPz7b0fUw+KzjMhbgES8lmowZv5ACW/WQuxDyS+LRkDiqyhLFbZZY7e45IvTmYRjZy6Qmxb8K2F1f3Ycapp56u4pSIujKebpsUkM9I5lNGnXlfQ96BOn7wba1CmZdyXzyZyiloWMV9OqB5IMsW31w6WPQ6K/ibTBWbm1PZVqk3VEaddsQbo6T9ynEZnv8miZ66x/pzQwZg== 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=b/qD4YQU9UBX2QLemhdFC0vYRw50NOR9F8fnfRi2ujg=; b=jqHBIut/ZxbfJT53SP+F1q1/5XOg6UM2ONcAdAT67c+od0NBJAE39H3VHJG1SWx0ywtzj32TlW1Fd/AIhsGyWwULIsjQ0WpPgHOiFzXGz41QPlJDF47l7uhM5BRFfOR60nmc3R4N2OZlOD9/XhRjUIgsj2lBom2qTdNGz8hJ7zQ= 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:17:20 +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:17:20 +0000 From: "Peng Fan (OSS)" Date: Sat, 04 May 2024 21:20:16 +0800 Subject: [PATCH v2 18/20] pinctrl: freescale: mxs: Fix refcount of child Message-Id: <20240504-pinctrl-cleanup-v2-18-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 X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714828815; l=1008; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=n5zUltymbb2QT8OVUi0ykdiDnyL/KXFAnvLfuklG8sk=; b=VlM2s8MWPklorkSZy9NCPoYCC+X1qhpT9U8O+RJ4UAzCFrQN9FgW0mVCVJh3cOF27q65t8QZ6 Ls7HHept/5WDey6gNVcw0jH5LWh2wGBBfxXZKtcPS/ES2kVoImJ3XLa 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: 4a333ccc-4d63-4645-7e99-08dc6c3c875d 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?szoXTRNoxTcuDANL/avvjllrPucT2s4?= =?utf-8?q?ub06toWixiLjN+2b44KXbOlW3Nz+u8zHbZMg9sWDKEOfCU0ZKMf0M2JpTY2qXe9PF?= =?utf-8?q?MNIS4VKC/JQmwh6fExGyi61fwX+tZISn+VbzoC42ZjUnRs9h/nO9aS/8o1j7PGFdg?= =?utf-8?q?0n4StYGT6GicheZg533jp7UQQYjzwnpcaW8JMdIRooDt8l6Ujb9VNy2X+eyQfoPYk?= =?utf-8?q?9H7tmU1jklj5+iFX21V6KQwtidvAbS/VPx+WYVPUK/Ux6gMDwzeTJsY+QPRwtv+XP?= =?utf-8?q?0bB9pKsWzA4v6Pk5sOQotfn/FJJ0aPluVp9CZSLO/Ou2pJrZfB1FoZtEZnDREyy36?= =?utf-8?q?rFhzefHJ2JPITpU/nOP2EfJSiyah/mISgByhHdsKE2znyU5Ts4M+Lz9hfXvrzx3sH?= =?utf-8?q?sYGp96Um0uF2rXiF+tMSXXLJr3eoReZak/d6mIWyn0wn7G4hwzeyflwTXztznUzHX?= =?utf-8?q?z9EJyyWHBwnF8ISUV1vOJtZtRYjLDyeTmZviWeWa8hG3AxjOTVxczouwBiA/Bmd5M?= =?utf-8?q?JKWYFUYwZIkw+smL+CWefpB10gGZBHn14wTe8sWn1r0giRPwe+0M5KtGVHa/e5il/?= =?utf-8?q?tMT/H6vFEbRquu+pspW7cQAcrBtGZX34echU2sGFaZAF2jFBe9mXLUp0fO9E9sj8v?= =?utf-8?q?p4ux43wqOUuRmx+E7dHjEgPHeWHIGtT6t2en8jFiJ3VIk5oAtyBLtrnPdrJH4Wsbe?= =?utf-8?q?xOvlmzYYCYLSEkrmfPfEjtMs8Ngy9sP11eg3+jzJfH4k9+2eZLvCN2EPqaxBfF042?= =?utf-8?q?fOe0786IbDXJCVe2i4lCqWkM7pwsqFIWNvUYThmYZwi4wKjB0fCqptKsxns215ort?= =?utf-8?q?QzgsWlopL0VnBegPQeaIol1xd1jJL1oWasZLqfuDUX/U7mLG5pFy1zLmVNmHGSV8z?= =?utf-8?q?gDYcFoBJW2zpvkb4gGyZNqZTJdWSskplLZerJxq9twepFD/gEfafzTcs9GzfkkFXj?= =?utf-8?q?s+TOU6I5uPfJrXVwhtci6Ix2M4LmTnmTR7Ypl493fYaGzHxTc5YawtYba1B6XmBQ2?= =?utf-8?q?DzcR4EQbE2+n3AkeFmiOqvb3IvtNavZjLsRWL6ePMU9gax3+IqRWPXgjzHj6tZiZt?= =?utf-8?q?MFdakBBdqANCtvCohpEvBzonGRq4V9fNJkbGulK2yvbDNYwFmTDmAK2h2sc4cGYqz?= =?utf-8?q?3IHxN8eR2mJZftiQk6MGpVahC449L/J0X48bS0VT0yOITtM57X0lhIm4UJZ8hFAwG?= =?utf-8?q?D9btDNnGfe2MNMB49VCjotHMYkIEw2jFFGOThW3A2paUeG9RQqJIA7lE5F525tBeU?= =?utf-8?q?dfn/NpIWiZKv4P8u89a1qenO5INjoactfyJKvsSx1utsUO2mruGz39w8=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-Chun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?utf-8?q?OZE/X5KLrxvQeIiM9PclyvJggZcBytNrOoxbmRkOZtpCwuDyD1nvfTq6itsfU+BUs?= =?utf-8?q?zDeEDQmzNGxE8nyTSCt8N6U8tsAzB+UGQAAWKPHHXtOkXCjIQFArqzpDaHZQ1CjHb?= =?utf-8?q?OOuaok45wgk1//je1n8UAdr2eCyWEdnUXxK5Itqrq6C2EC6xu7l9VGBEoJbTD1yoU?= =?utf-8?q?L3WBNCG7EgFMra2bvvUq3PpecLCiZ8CALjBUaSCrnc9lBU+/M9q8kP0kISRoP1syQ?= =?utf-8?q?lzyr2Ftrwp6LsT1BR+XySGCX2y9q2HU0leyZayg1HYhbthzK/wpJcYihFd2QXk+hU?= =?utf-8?q?3SECgEu7P6iX53cpvSt3b7KHr+cYQMc5lCC43kj1XOmSc5sxLnAKPeNrUXR98vNRR?= =?utf-8?q?MbcO7z+GUgsY17xrqY3nPGRj6PX1p/FyFFvNPaF60mJ//1VohtLDh/wzsD/khhwss?= =?utf-8?q?hALKYdxDm8SfJcQx7VT9H4otKNzQoamn7l13bMl6b+nU5Q7zFfnX0lgZvYTTosCLS?= =?utf-8?q?0XvhlO8FVqHQhAjImcillBs6TD/1CH40gy5QtKchvUvidQQkc05wIl9ehHU3J4au5?= =?utf-8?q?7cjeSQrfEcPs4UTZFL2YmhlX+YRsGBWeKcFIsOCUy2lha6EZirdV5m/OcbqWt0E8c?= =?utf-8?q?bryazPvmnBD0A0idvbc1YQ1Hb47JIKzErN1Vu3DiCu8U6e4M9X7+4e6Ap0jTJmqhL?= =?utf-8?q?emodOOEYN6aM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a333ccc-4d63-4645-7e99-08dc6c3c875d 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:17:20.5544 (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: eS0Hqw20bfQUZBCxvAY/jHXjr5fiJodXMP/iYb+b2NEaYZD9Se67ioovz8+ccXYKulvQ7D65SmO1VsXjEHyfdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8633 X-Mailman-Approved-At: Tue, 20 Aug 2024 09:56:01 +1000 X-BeenThere: linux-aspeed@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux ASPEED SoC development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imx@lists.linux.dev, Peng Fan , linux-samsung-soc@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-rockchip@lists.infradead.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Errors-To: linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linux-aspeed" From: Peng Fan of_get_next_child() will increase refcount of the returned node, need use of_node_put() on it when done. Per current implementation, 'child' will be override by for_each_child_of_node(np, child), so use of_get_child_count to avoid refcount leakage. Fixes: 17723111e64f ("pinctrl: add pinctrl-mxs support") Signed-off-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-mxs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c index aee70fa55bec..edb242d30609 100644 --- a/drivers/pinctrl/freescale/pinctrl-mxs.c +++ b/drivers/pinctrl/freescale/pinctrl-mxs.c @@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev, int ret; u32 val; - child = of_get_next_child(np, NULL); - if (!child) { + val = of_get_child_count(np); + if (val == 0) { dev_err(&pdev->dev, "no group is defined\n"); return -ENOENT; }