From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Brugger Subject: Re: [RFC PATCH 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Date: Fri, 4 Sep 2015 10:39:34 +0200 Message-ID: <55E958C6.5090209@gmail.com> References: <1441336900-15095-1-git-send-email-alexey.klimov@linaro.org> <1441336900-15095-3-git-send-email-alexey.klimov@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1441336900-15095-3-git-send-email-alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+glpam-linux-mediatek=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org To: Alexey Klimov , daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, klimov.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: linux-mediatek@lists.infradead.org On 04/09/15 05:21, Alexey Klimov wrote: > Add error path to clear evt struct allocated by kzalloc() > in the beginning of function mtk_timer_init(). > > Signed-off-by: Alexey Klimov > --- > drivers/clocksource/mtk_timer.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c > index fbaacbf..9c5a2cc 100644 > --- a/drivers/clocksource/mtk_timer.c > +++ b/drivers/clocksource/mtk_timer.c > @@ -201,7 +201,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); > @@ -256,5 +256,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); > Acked-by: Matthias Brugger