aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/kernel/time.c
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-06-17 20:44:32 +0800
committerMax Filippov <jcmvbkbc@gmail.com>2022-06-18 14:46:59 -0700
commita0117dc956429f2ede17b323046e1968d1849150 (patch)
tree828718baec0cc6270761d05dd4c64f361052534d /arch/xtensa/kernel/time.c
parentLinux 5.19-rc2 (diff)
downloadlinux-dev-a0117dc956429f2ede17b323046e1968d1849150.tar.xz
linux-dev-a0117dc956429f2ede17b323046e1968d1849150.zip
xtensa: Fix refcount leak bug in time.c
In calibrate_ccount(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Cc: stable@vger.kernel.org Signed-off-by: Liang He <windhl@126.com> Message-Id: <20220617124432.4049006-1-windhl@126.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa/kernel/time.c')
-rw-r--r--arch/xtensa/kernel/time.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index e8ceb1528608..16b8a6273772 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -154,6 +154,7 @@ static void __init calibrate_ccount(void)
cpu = of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu");
if (cpu) {
clk = of_clk_get(cpu, 0);
+ of_node_put(cpu);
if (!IS_ERR(clk)) {
ccount_freq = clk_get_rate(clk);
return;