Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F261DC43334 for ; Wed, 15 Jun 2022 07:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Xvmkt+IBnwCQPkC69aubNTCR/OFoIYGT+t7FLDvaHPA=; b=CTQ/r1oS63FU+g mec28T63U/LPE+Mw4wj50tuIHyrlJxm9ATLOOoXhfZ/fn4zkjzBYB86GsmbL62PFFBPar2HDQYyZt 3ypixl5n8b0PIB5MFI1Dwvaxcjqh0iHzqpLJ6MasxvRso/AjGSM4Tt1DaqZq18DCfpEjJ+DCH4zEJ DhPzs6neIYh1hnrKl0GB57jjRm+VlG9PYivUTmsNYG7ulupNRumS2XKP4PSINNHqkgfNLhGV1Rv0Q XSGvGTmAWFLF/I5R3nE+vmJvvIPFLbcOiertw2K/Uke3r2KK8Qm1ungVdyuoX6LTNAkhgfu7s3OgV jj4iw+/VcW5kA60h6Rhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1NaE-00D3Mh-Pc; Wed, 15 Jun 2022 07:36:58 +0000 Received: from mail-m965.mail.126.com ([123.126.96.5]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1NaB-00D3LA-UB for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 07:36:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=ikIid BQrD2yinS2OKqOxtYEJxzVsedYVIVxucjwcqLY=; b=NLhNMnMdoHLlMJxUCtY/d EEk9lbJcge6ZR8ZWc+WtOw454Pu0QZoxRG9hiFMe8RaxbG6PuDlpArll0BEF6cEp xQnbOFcP9kh5Wh4Xk+R+34ZBiymC+g+XCdqA3j/Mbh8PL6zOLMHt8/YJlOwg1lW9 euno9e4cY/jjfYibp3EzbU= Received: from localhost.localdomain (unknown [124.16.139.61]) by smtp10 (Coremail) with SMTP id NuRpCgDHDGEBjKli_BquEg--.33320S2; Wed, 15 Jun 2022 15:36:34 +0800 (CST) From: heliang To: linux@armlinux.org.uk, heiko@sntech.de Cc: linux-arm-kernel@lists.infradead.org, windhl@126.com Subject: [PATCH] arm: mach-rockchip: Add missing of_node_put Date: Wed, 15 Jun 2022 15:36:31 +0800 Message-Id: <20220615073631.3959768-1-windhl@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: NuRpCgDHDGEBjKli_BquEg--.33320S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrtryUCFWxGr4xWr4ktrWDurg_yoWDZrgEgw 1xW39rXr1rG3W8Zaykua43Gw4DA3s5Gr13uay8AF10qa1DJr1UWFs5t34Iy34xWFWavrW3 GrsFg3sxCwnFkjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRt5rc7UUUUU== X-Originating-IP: [124.16.139.61] X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbi2gIhF1uwMNOVAgAAsx X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_003656_424549_A7747D93 X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In rockchip_suspend_init, of_find_matching_node_and_match() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when the pointer is not used anymore. Signed-off-by: heliang --- arch/arm/mach-rockchip/pm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c index 87389d9456b9..5db6a6c6c088 100644 --- a/arch/arm/mach-rockchip/pm.c +++ b/arch/arm/mach-rockchip/pm.c @@ -310,6 +310,7 @@ void __init rockchip_suspend_init(void) np = of_find_matching_node_and_match(NULL, rockchip_pmu_of_device_ids, &match); if (!match) { + of_node_put(np); pr_err("Failed to find PMU node\n"); return; } @@ -319,10 +320,11 @@ void __init rockchip_suspend_init(void) ret = pm_data->init(np); if (ret) { + of_node_put(np); pr_err("%s: matches init error %d\n", __func__, ret); return; } } - + of_node_put(np); suspend_set_ops(pm_data->ops); } -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel