ARM: OMAP2+: Fix memleak in omap2xxx_clkt_vps_init

If the clk_register fails, we should free hw before function returns to
prevent memleak.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
Youling Tang 2020-11-14 12:06:58 +08:00 committed by Tony Lindgren
parent 3650b228f8
commit 3c5902d270
1 changed files with 6 additions and 0 deletions

View File

@ -244,6 +244,12 @@ void omap2xxx_clkt_vps_init(void)
hw->hw.init = &init;
clk = clk_register(NULL, &hw->hw);
if (IS_ERR(clk)) {
printk(KERN_ERR "Failed to register clock\n");
kfree(hw);
return;
}
clkdev_create(clk, "cpufreq_ck", NULL);
return;
cleanup: