linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] arm: Fix kfree NULL pointer in omap2xxx_clkt_vps_init
@ 2020-11-14  4:07 Youling Tang
  0 siblings, 0 replies; only message in thread
From: Youling Tang @ 2020-11-14  4:07 UTC (permalink / raw)
  To: Tony Lindgren, Russell King; +Cc: linux-omap, linux-arm-kernel, linux-kernel

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>
---
 arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 70892b3..edf046b 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -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
-- 
2.1.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-14  4:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-14  4:07 [PATCH 2/2] arm: Fix kfree NULL pointer in omap2xxx_clkt_vps_init Youling Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).