[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220516074100.30599-1-linmq006@gmail.com>
Date: Mon, 16 May 2022 11:41:00 +0400
From: Miaoqian Lin <linmq006@...il.com>
To: Nishanth Menon <nm@...com>,
Santosh Shilimkar <ssantosh@...nel.org>,
Keerthy <j-keerthy@...com>, Tony Lindgren <tony@...mide.com>,
Dave Gerlach <d-gerlach@...com>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Cc: linmq006@...il.com
Subject: [PATCH] soc: ti: pm33xx: Fix refcount leak in am33xx_pm_rtc_setup
of_find_node_by_name() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.
Fixes: 5a99ae0092fe ("soc: ti: pm33xx: AM437X: Add rtc_only with ddr in self-refresh support")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/soc/ti/pm33xx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/ti/pm33xx.c b/drivers/soc/ti/pm33xx.c
index 7bab4bbaf02d..b4d6e6ad85f4 100644
--- a/drivers/soc/ti/pm33xx.c
+++ b/drivers/soc/ti/pm33xx.c
@@ -445,8 +445,10 @@ static int am33xx_pm_rtc_setup(void)
if (of_device_is_available(np)) {
/* RTC interconnect target module clock */
rtc_fck = of_clk_get_by_name(np->parent, "fck");
- if (IS_ERR(rtc_fck))
- return PTR_ERR(rtc_fck);
+ if (IS_ERR(rtc_fck)) {
+ error = PTR_ERR(rtc_fck);
+ goto err_node_put;
+ }
rtc_base_virt = of_iomap(np, 0);
if (!rtc_base_virt) {
@@ -479,6 +481,7 @@ static int am33xx_pm_rtc_setup(void)
} else {
pr_warn("PM: no-rtc available, rtc-only mode disabled.\n");
}
+ of_node_put(np);
return 0;
@@ -486,7 +489,8 @@ static int am33xx_pm_rtc_setup(void)
iounmap(rtc_base_virt);
err_clk_put:
clk_put(rtc_fck);
-
+err_node_put:
+ of_node_put(np);
return error;
}
--
2.25.1
Powered by blists - more mailing lists