Commit 11faa20e authored by Alexey Klimov's avatar Alexey Klimov Committed by Daniel Lezcano

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: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: default avatarAlexey Klimov <alexey.klimov@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 6cd7ccaa
......@@ -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 @@ static void __init mtk_timer_init(struct device_node *node)
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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment