From patchwork Fri Feb 7 01:31:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 863173 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 36E9A13C80C; Fri, 7 Feb 2025 01:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892387; cv=none; b=IV+24djcLCYnt1dYAgejZjQHiiwQ4fXpvgY8JEFh4rtBJ61MQnq+zO1mRRljKBz8mMvBHG4keIlJeprEMkNmLzFnZ0xy/XNzbEl4G/mBMQnDS3FH2/XwaBbmQhuf1EjxXVjF2+eU26GMNcMyk1TeaGgox6ia5lhpKB5hnV3ienU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892387; c=relaxed/simple; bh=o0VB9aCkXoeWVuLjjF+y87XwF4Mnfj+g+UOEQ1+cBOk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U8b3aJVv+akL5vuKD1nBOvxw3ccqdDD5dNauGM3dbZltHsp4rwRkx84SOSjcmyKcim3mqf6IzYZxQnB6XjWe2AcYVbbFLf7LtboRhx6EM0SQqNHabWQVhfpVGqJvzYgoZc3GGXFtKvJY/JCnR8V4+yQb0JGIeHjiqsFLWh5PGbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4YpxSG4vYwzrT0J; Fri, 7 Feb 2025 09:38:06 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 8EC5F1400DD; Fri, 7 Feb 2025 09:39:42 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 7 Feb 2025 09:39:40 +0800 From: Zhang Zekun To: , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 1/9] of: Add warpper function of_find_node_by_name_balanced() Date: Fri, 7 Feb 2025 09:31:09 +0800 Message-ID: <20250207013117.104205-2-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20250207013117.104205-1-zhangzekun11@huawei.com> References: <20250207013117.104205-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) There are many drivers use of_find_node_by_name() with a not-NULL device_node pointer, and a number of callers would require a call to of_node_get() before using it. There are also some drivers who forget to call of_node_get() which would cause a ref count leak[1]. So, Add a wraper function for of_find_node_by_name(), drivers may use this function to call of_find_node_by_name() with the refcount already balanced. [1] https://lore.kernel.org/all/20241024015909.58654-1-zhangzekun11@huawei.com/ Signed-off-by: Zhang Zekun --- include/linux/of.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index eaf0e2a2b75c..b7c6d7ff278c 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -268,6 +268,11 @@ static inline const char *of_node_full_name(const struct device_node *np) #define for_each_of_allnodes(dn) for_each_of_allnodes_from(NULL, dn) extern struct device_node *of_find_node_by_name(struct device_node *from, const char *name); +static inline struct device_node *of_find_node_by_name_balanced(struct device_node *from, + const char *name) +{ + return of_find_node_by_name(of_node_get(from), name); +} extern struct device_node *of_find_node_by_type(struct device_node *from, const char *type); extern struct device_node *of_find_compatible_node(struct device_node *from, From patchwork Fri Feb 7 01:31:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 863172 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 A6B0014F9FF; Fri, 7 Feb 2025 01:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892391; cv=none; b=DAHbBAVbBw9zUhxhi56pVpLCjDwmrnUKOa6xt5fCR4CnK0lRZuD+gzFhBJYigjmUPa76j7UUhsBaij9PusbPGtlOTxWaY+KOpP7zwy0bPoooRGZveeQRskhEvUfwc7pWwZtV/tSHoWaLDbMFi8PCE0CoG4WfjGDJirxZ8xYBg2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892391; c=relaxed/simple; bh=1hQa0rb30YjPWJmEFp08HbH73q83lHNBrJsFri4y1Pg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VOtdtNT3+hnqK1eEq7qJcnOwgtFowh2O9LArcwTNX8x6r57e48baML616u5abG5OVRZT/xIinwaEfQQjFmUulwkCFShU2+VN4jMEUpuZigbcovcxJfFeHn9FG2Pv4K73dY8fz3eSGFxAv7OdeCMVpir4ZRFbRDLwK5HHuS6o3R0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4YpxQy6DbnzmZC4; Fri, 7 Feb 2025 09:36:58 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 21BB41400DD; Fri, 7 Feb 2025 09:39:46 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 7 Feb 2025 09:39:44 +0800 From: Zhang Zekun To: , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 3/9] net: pse-pd: Add missing of_node_get() before of_find_node_by_name() Date: Fri, 7 Feb 2025 09:31:11 +0800 Message-ID: <20250207013117.104205-4-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20250207013117.104205-1-zhangzekun11@huawei.com> References: <20250207013117.104205-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) of_find_node_by_name() will decrease the refount of the device_node. So, get the device_node before passing to it. Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver") Signed-off-by: Zhang Zekun --- drivers/net/pse-pd/tps23881.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c index 5e9dda2c0eac..a595358ac60b 100644 --- a/drivers/net/pse-pd/tps23881.c +++ b/drivers/net/pse-pd/tps23881.c @@ -502,7 +502,7 @@ tps23881_get_of_channels(struct tps23881_priv *priv, if (!priv->np) return -EINVAL; - channels_node = of_find_node_by_name(priv->np, "channels"); + channels_node = of_find_node_by_name_balanced(priv->np, "channels"); if (!channels_node) return -EINVAL; From patchwork Fri Feb 7 01:31:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 863171 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 260F818C907; Fri, 7 Feb 2025 01:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892393; cv=none; b=opqKlBTheNkwolI2JJmhQhurxkaAs9pznk7IHlT2HPErdko3YrDXptq/rXJTLSWjFEOzzey8RmemQsjloQyYKHdDsQ03LGknzM3PDXR3j+BHSpOaD9jkmbL08ZxOGIHdZeb+89ZBZ32bGV+6L4Q8C+cjFxfzJ6WOuO2pbPoC8B0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892393; c=relaxed/simple; bh=u6KVkOE4Dtix3HpVfbet9p/5YAPxwXqg9Ba7CU/Q/CM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GgylpyB9jagQrF+4IiDyXbzhYOKa6XVaIAM06G3X9bCqZxu5kyHlZu6Pksd55Ukw4YisVf73dffaTIwDzoIIPbaCO8NRyxyE0tk+MtbKdqjBi6fk53sGK6EVC4HKBUygJQmAuEvu2APphjdxaVQn9ogd/He8xAuG8vWggOefWJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YpxR24hwTz22m8l; Fri, 7 Feb 2025 09:37:02 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id A8ED714010C; Fri, 7 Feb 2025 09:39:49 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 7 Feb 2025 09:39:47 +0800 From: Zhang Zekun To: , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 5/9] powerpc: Use of_find_node_by_name_balanced() to find device_node Date: Fri, 7 Feb 2025 09:31:13 +0800 Message-ID: <20250207013117.104205-6-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20250207013117.104205-1-zhangzekun11@huawei.com> References: <20250207013117.104205-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- arch/powerpc/platforms/powermac/pic.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 2202bf77c7a3..0619334adf2a 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c @@ -308,9 +308,7 @@ static void __init pmac_pic_probe_oldstyle(void) /* We might have a second cascaded heathrow */ - /* Compensate for of_node_put() in of_find_node_by_name() */ - of_node_get(master); - slave = of_find_node_by_name(master, "mac-io"); + slave = of_find_node_by_name_balanced(master, "mac-io"); /* Check ordering of master & slave */ if (of_device_is_compatible(master, "gatwick")) { From patchwork Fri Feb 7 01:31:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 863170 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 8E93618DB25; Fri, 7 Feb 2025 01:39:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892398; cv=none; b=XsxcmzMzBN2saovaw4301z/73NrutyoUIPPS+q1oYNV6drkhjONewwO/5ingxoOADxNDA51KUXhESggxqu8Re/Bvq2Je/JHBMuBuM5HslvYCFNPw35vtlelZppxc9xhfmG8B6diFXhcFdJ/qWeiavG3zXKcyjm1lQS9sd3QwnoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892398; c=relaxed/simple; bh=FJLMbXk2KC0si+MELnXdP1nMRRU5eMmkQQBTJn9ojhM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fn+060kgBqQMiWc5YpkXvcpdlpylZOzz9qbXYMrXNu7a4YBVb+RtFroEw03Fyzt3iTeRSILq9KXkrR28OPQXQomuFIwgLN9m3WJ70cL/WzZerTLNzY9JFvW9CmeMU/C9ieWJJiTVUAch6Ltvvb4MWxO4HOVM+hKk6MCtckdb8D0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YpxQL3PL4zbnrS; Fri, 7 Feb 2025 09:36:26 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id 3E410140156; Fri, 7 Feb 2025 09:39:53 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 7 Feb 2025 09:39:51 +0800 From: Zhang Zekun To: , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 7/9] net: dsa: hellcreek: Use of_find_node_by_name_balanced() to find device_node Date: Fri, 7 Feb 2025 09:31:15 +0800 Message-ID: <20250207013117.104205-8-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20250207013117.104205-1-zhangzekun11@huawei.com> References: <20250207013117.104205-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/net/dsa/hirschmann/hellcreek_ptp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c index bfe21f9f7dcd..360ceb6831ed 100644 --- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c +++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c @@ -307,8 +307,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek) const char *label; int ret = -EINVAL; - of_node_get(hellcreek->dev->of_node); - leds = of_find_node_by_name(hellcreek->dev->of_node, "leds"); + leds = of_find_node_by_name_balanced(hellcreek->dev->of_node, "leds"); if (!leds) { dev_err(hellcreek->dev, "No LEDs specified in device tree!\n"); return ret; From patchwork Fri Feb 7 01:31:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Zekun X-Patchwork-Id: 863169 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 174F01917D0; Fri, 7 Feb 2025 01:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892400; cv=none; b=hVWpcpBu4x+HrXinUPiPuhdXZsasIxZzadtlgVCdCydN/o9Rfd24o4wrVnc5vvNMEUf296S4wbIP2FlDdehIfp5TeelqbWhv9EKt1ol057axSuwhSi1m1LR/7MBOOxAJgCu6frW+7kSxAfbOHJ1g1CCK/2PT0+d481epQLxU4vU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738892400; c=relaxed/simple; bh=txYL5vHk4cRuMflmnp/SyGG+L6ZQPYHZeWaTctmwH0k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rKsc6/xjvBnG8dhjws9ZekLgfo6i8lBJY/2eo/vFUOpzYsSCjSeJ1L7harNqL64MQQV9B1zJPHvM6WSN18rr4tLjJl8M7BxzIOvrTqcOVtjsOOr2ASYChjLmbc4Fpsew5olnHDRwQiWUVZ7NdgI2vyVL58WMLcivh+z+ab/j7s0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4YpxPN4fb4z11Pg3; Fri, 7 Feb 2025 09:35:36 +0800 (CST) Received: from kwepemf500003.china.huawei.com (unknown [7.202.181.241]) by mail.maildlp.com (Postfix) with ESMTPS id F249D180064; Fri, 7 Feb 2025 09:39:56 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemf500003.china.huawei.com (7.202.181.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 7 Feb 2025 09:39:54 +0800 From: Zhang Zekun To: , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Subject: [PATCH 9/9] regulator: scmi: Use of_find_node_by_name_balanced() to find device_node Date: Fri, 7 Feb 2025 09:31:17 +0800 Message-ID: <20250207013117.104205-10-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20250207013117.104205-1-zhangzekun11@huawei.com> References: <20250207013117.104205-1-zhangzekun11@huawei.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf500003.china.huawei.com (7.202.181.241) Instead of directly using of_node_get() before of_find_node_by_name() to balance the refcount of the device_node, using wraper function of_find_node_by_name_balanced() to make code logic a bit simplier. Signed-off-by: Zhang Zekun --- drivers/regulator/scmi-regulator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c index 9df726f10ad1..11f75c13bdf0 100644 --- a/drivers/regulator/scmi-regulator.c +++ b/drivers/regulator/scmi-regulator.c @@ -339,8 +339,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev) * plausible SCMI Voltage Domain number, all belonging to this SCMI * platform instance node (handle->dev->of_node). */ - of_node_get(handle->dev->of_node); - np = of_find_node_by_name(handle->dev->of_node, "regulators"); + np = of_find_node_by_name_balanced(handle->dev->of_node, "regulators"); for_each_child_of_node_scoped(np, child) { ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo); /* abort on any mem issue */