[PATCH] clk: renesas: Fix memory leak of 'cpg'
From: Haowen Bai
Date: Wed Apr 13 2022 - 04:06:17 EST
Fix this issue by freeing the cpg when exiting the function in the
error/normal path.
Signed-off-by: Haowen Bai <baihaowen@xxxxxxxxx>
---
drivers/clk/renesas/clk-r8a7779.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/renesas/clk-r8a7779.c b/drivers/clk/renesas/clk-r8a7779.c
index 9f3b5522eef5..dd7c67f522fd 100644
--- a/drivers/clk/renesas/clk-r8a7779.c
+++ b/drivers/clk/renesas/clk-r8a7779.c
@@ -170,6 +170,9 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
cpg_mstp_add_clk_domain(np);
+
+ kfree(cpg);
+ kfree(clks);
}
CLK_OF_DECLARE(r8a7779_cpg_clks, "renesas,r8a7779-cpg-clocks",
r8a7779_cpg_clocks_init);
--
2.7.4