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 */