diff options
author | Youling Tang <tangyouling@loongson.cn> | 2020-11-14 12:06:58 +0800 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2020-11-19 11:44:46 +0200 |
commit | 3c5902d270edb6ccc3049acfe5d3e96653c87dcd (patch) | |
tree | 234a9b125050f5e97628b5ce582a5ea1d01bba10 | |
parent | 3650b228f83adda7e5ee532e2b90429c03f7b9ec (diff) | |
download | linux-3c5902d270edb6ccc3049acfe5d3e96653c87dcd.tar.gz |
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>
-rw-r--r-- | arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c index 2a3e72286d3a..70892b3da28d 100644 --- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c @@ -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: |