[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221108141241.42007-1-judy.chenhui@huawei.com>
Date: Tue, 8 Nov 2022 22:12:41 +0800
From: Chen Hui <judy.chenhui@...wei.com>
To: <vgupta@...nel.org>, <Vladislav.Zakharov@...opsys.com>
CC: <linux-snps-arc@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <judy.chenhui@...wei.com>
Subject: [PATCH] arch: arc: Fix memory leak in show_cpuinfo()
The "cpu_clk" resource is malloced by clk_get(),
it is not released when the function return.
Fixes: 7f35144cea21 ("ARC: get rate from clk driver instead of reading device tree")
Signed-off-by: Chen Hui <judy.chenhui@...wei.com>
---
arch/arc/kernel/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 41f07b3e594e..9457c7ad8707 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -637,6 +637,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
cpu_id);
} else {
freq = clk_get_rate(cpu_clk);
+ clk_put(cpu_clk);
}
if (freq)
seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n",
--
2.17.1
Powered by blists - more mailing lists