[PATCH] clocksource/drivers/cadence-ttc: Fix memleak in ttc_setup_clockevent
From: Dinghao Liu
Date: Sun Aug 23 2020 - 09:07:18 EST
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@xxxxxxxxxx>
---
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