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: 13654041 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2054.outbound.protection.outlook.com [40.107.22.54]) (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 672582E642 for ; Sat, 4 May 2024 13:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828645; cv=fail; b=mDnnI9wGMv2rx2vzbJeAdxXB11iwn1fEXWyzCbNWCHzet7/J6CvYV70IAUhQ7MQ1vCo9O16JKv40nkXtpz5dzynrEF9jJcb4AKFT9J/WlNU7WtlmBFR1QS+V2/Xcj1uYNC23mf/clYvknysAjYAx5ikOyv2sEcBKqO+ueBX5PrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714828645; c=relaxed/simple; bh=VIt+S9lqc+k4TIsuVnBU6FhhXcdzzv/izY3n11KkU7c=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=pd58cPwY/oGQe9je8VcGC4xejWvuNNXV/AKnph0B1QYgjkc6lYawbkmacH4VDctzcmgu77wNB940BtHN4IcCutNQS5dQSr+Z4wwU0UY3UD/qkcIpCeEk1BYchJTU8iRf5wvAjxbDCoWpz5eBWyj5yZTdW4I+Z6TeTZ3XhKAjB0Y= 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=jqHBIut/; arc=fail smtp.client-ip=40.107.22.54 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="jqHBIut/" 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 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=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) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: 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-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZUY80xlmj6osCGxyuq9Ra/6hxZFX?= =?utf-8?q?ccuWxoOgkbJ8kSfExgOqKUHfvnwHXVggCv4fgloE/PA82vjH8+QwszseNicHJTtdv?= =?utf-8?q?mGmJy2dRCcWjOSaOniyHXhhgqEhM8WhMkZ7H9DcO8ux13faWmiwjNYoDOhHXi2aKi?= =?utf-8?q?D/orsO+qvhZd4e+MNJwzNmvk6VGSYgRnNQ7wwgaCLfRDJYe1hiqFaauKLJkxuRuBb?= =?utf-8?q?tL0yT25HZAllD+zT0ZijBMwO6h8zyreIAX/KpO6FP+AkI32lo0H5wSEq46uZvgKBw?= =?utf-8?q?DKwGVOWUsTvlPYr5Y9URoVbL86nkmt3ZA9RrTj/wgsTbvERHjjG1O/i6Yq3xmYCJY?= =?utf-8?q?EKaQo5CtkRoIfPF/N1XHZ5l4AdLWcfWmFn6iLRYNtucn1MKHi38ne08lUtmzfXdEA?= =?utf-8?q?/pjmbyhk9Kc4TkaaeBsYNQlzYkeGn9HNESff1ylMs8k8KBoZfNwky/XxS9i3cm4EK?= =?utf-8?q?Wv1TnMTbva4k0s5q/mejU7WuGm4dWj51aZqi8Q0JClCNT+qp4RNmxCpx3Uz15Wnvu?= =?utf-8?q?hXrIJN7Tk+cSQlvmT/eOpj9TKUAzgIsgbqIiGufBJWnfQUyg5o7Y/bi7CPdysh1rA?= =?utf-8?q?Xvg3BYJ74wMMy7Jdz9XaLuqwjOSpAd6ytM/dqieE9KITX1dAIY4g7Lrxlt44/48PJ?= =?utf-8?q?by1PYBs8uva+Zlq2sguSKtx4zCGJm05xMlfvhlZHz4ry07QQMq6pXKAukBEeX6n1Q?= =?utf-8?q?SCizhwZpP4AQZG9HLphXRvTCpIc25SR8I5aoaPMtocE82O7txVgsxGWdSb9WeoZyw?= =?utf-8?q?EFsTI/PfGGcfdTei0Mdg5gbGsXtdFkheTWkXiqf9fkenFC/JsH6OstibNGfAADKef?= =?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 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; }