linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/cadence-ttc: Fix memleak in ttc_setup_clockevent
@ 2020-08-23 13:06 Dinghao Liu
  0 siblings, 0 replies; only message in thread
From: Dinghao Liu @ 2020-08-23 13:06 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Michal Simek, Daniel Lezcano, Thomas Gleixner, linux-arm-kernel,
	linux-kernel

When clk_notifier_register() fails, ttcce should be freed
just like when clk_prepare_enable() and request_irq() fail.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/clocksource/timer-cadence-ttc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c
index 38858e141731..4d8638b0936c 100644
--- a/drivers/clocksource/timer-cadence-ttc.c
+++ b/drivers/clocksource/timer-cadence-ttc.c
@@ -426,6 +426,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
 				    &ttcce->ttc.clk_rate_change_nb);
 	if (err) {
 		pr_warn("Unable to register clock notifier.\n");
+		kfree(ttcce);
 		return err;
 	}
 
-- 
2.17.1


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

only message in thread, other threads:[~2020-08-23 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 13:06 [PATCH] clocksource/drivers/cadence-ttc: Fix memleak in ttc_setup_clockevent Dinghao Liu

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).