All of lore.kernel.org
 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; 2+ messages 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] 2+ messages in thread

* [PATCH] clocksource/drivers/cadence-ttc: Fix memleak in ttc_setup_clockevent
@ 2020-08-23 13:06 ` Dinghao Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Dinghao Liu @ 2020-08-23 13:06 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Thomas Gleixner, Daniel Lezcano, Michal Simek, 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-23 13:09 UTC | newest]

Thread overview: 2+ messages (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
2020-08-23 13:06 ` Dinghao Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.