linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent
@ 2019-10-21 20:18 Navid Emamdoost
  2019-10-22  8:26 ` Markus Elfring
  0 siblings, 1 reply; 14+ messages in thread
From: Navid Emamdoost @ 2019-10-21 20:18 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Michal Simek,
	Daniel Lezcano, Thomas Gleixner, linux-arm-kernel, linux-kernel

In the impelementation of ttc_setup_clockevent() the allocated memory
for ttcce should be released if clk_notifier_register() fails.

Fixes: 70504f311d4b ("clocksource/drivers/cadence_ttc: Convert init function to return error")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 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 88fe2e9ba9a3..b40fc6581389 100644
--- a/drivers/clocksource/timer-cadence-ttc.c
+++ b/drivers/clocksource/timer-cadence-ttc.c
@@ -424,6 +424,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] 14+ messages in thread

end of thread, other threads:[~2019-12-17 15:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 20:18 [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent Navid Emamdoost
2019-10-22  8:26 ` Markus Elfring
2019-10-22  8:51   ` Michal Simek
2019-10-23  4:31     ` [PATCH v2] " Navid Emamdoost
2019-10-23  7:32       ` Michal Simek
2019-10-23  8:00       ` Markus Elfring
2019-10-23  4:47     ` [PATCH] clocksource/drivers: Fix error handling in ttc_setup_clocksource Navid Emamdoost
2019-10-23  7:24       ` Markus Elfring
2019-10-23  8:20       ` Markus Elfring
2019-10-23 10:31       ` Markus Elfring
2019-12-14 22:54       ` Navid Emamdoost
2019-12-16 13:41         ` Daniel Lezcano
2019-12-17 15:09           ` Michal Simek
2019-10-23  4:50     ` [PATCH] clocksource/drivers: Fix memory leak in ttc_setup_clockevent Navid Emamdoost

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