arch: arc: Fix memory leak in show_cpuinfo()

Message ID 20221108141241.42007-1-judy.chenhui@huawei.com
State New
Headers
Series arch: arc: Fix memory leak in show_cpuinfo() |

Commit Message

Chen Hui Nov. 8, 2022, 2:12 p.m. UTC
  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@huawei.com>
---
 arch/arc/kernel/setup.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

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",