summaryrefslogtreecommitdiff
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorAlexey Klimov <alexey.klimov@linaro.org>2015-10-25 23:21:24 +0000
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-12-15 09:41:04 +0100
commit11faa20eb43997baae0c72916d8a959efcb6f8c4 (patch)
tree5d9688fc459184b5fae1adcc9648789732d40055 /drivers/clocksource
parent6cd7ccaaa84f6d9ee9ed33c66d7492121e2b98fd (diff)
clocksource/drivers/mtk_timer: Fix memleak in mtk_timer_init()
Add error path to clear evt struct allocated by kzalloc() in the beginning of function mtk_timer_init(). Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/mtk_timer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index e1e06429734f..d67bc356488f 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -205,7 +205,7 @@ static void __init mtk_timer_init(struct device_node *node)
evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer");
if (IS_ERR(evt->gpt_base)) {
pr_err("Can't get resource\n");
- return;
+ goto err_kzalloc;
}
evt->dev.irq = irq_of_parse_and_map(node, 0);
@@ -260,5 +260,7 @@ err_mem:
iounmap(evt->gpt_base);
of_address_to_resource(node, 0, &res);
release_mem_region(res.start, resource_size(&res));
+err_kzalloc:
+ kfree(evt);
}
CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);