ARM: OMAP2+: Fix kfree NULL pointer in omap2xxx_clkt_vps_init
authorYouling Tang <tangyouling@loongson.cn>
Sat, 14 Nov 2020 04:07:20 +0000 (12:07 +0800)
committerTony Lindgren <tony@atomide.com>
Thu, 19 Nov 2020 09:44:46 +0000 (11:44 +0200)
The returns pointer is NULL when kzalloc fails to apply for space, so fix
kfree NULL pointer.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c

index 70892b3da28d3221963712a0ffffd844d2bfd2c3..edf046b470ba23eaa8cea47ad047da943a9a2323 100644 (file)
@@ -235,7 +235,7 @@ void omap2xxx_clkt_vps_init(void)
 
        hw = kzalloc(sizeof(*hw), GFP_KERNEL);
        if (!hw)
-               goto cleanup;
+               return;
        init.name = "virt_prcm_set";
        init.ops = &virt_prcm_set_ops;
        init.parent_names = &parent_name;
@@ -251,8 +251,5 @@ void omap2xxx_clkt_vps_init(void)
        }
 
        clkdev_create(clk, "cpufreq_ck", NULL);
-       return;
-cleanup:
-       kfree(hw);
 }
 #endif