linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Alexey Klimov
	<alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	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
Subject: Re: [RFC PATCH 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init()
Date: Fri, 4 Sep 2015 10:39:34 +0200	[thread overview]
Message-ID: <55E958C6.5090209@gmail.com> (raw)
In-Reply-To: <1441336900-15095-3-git-send-email-alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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 <alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>   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 <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

  parent reply	other threads:[~2015-09-04  8:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04  3:21 [RFC PATCH 1/3] clocksource: mtk_timer: add pr_fmt define Alexey Klimov
2015-09-04  3:21 ` [RFC PATCH 2/3] clocksource: mtk_timer: change pr_warn()s to pr_err()s in mtk_timer_init Alexey Klimov
2015-09-04  3:40   ` Joe Perches
2015-09-04  8:50   ` Matthias Brugger
2015-09-04  3:21 ` [RFC PATCH 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init() Alexey Klimov
     [not found]   ` <1441336900-15095-3-git-send-email-alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-04  8:39     ` Matthias Brugger [this message]
2015-09-04  8:51 ` [RFC PATCH 1/3] clocksource: mtk_timer: add pr_fmt define Matthias Brugger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E958C6.5090209@gmail.com \
    --to=matthias.bgg-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alexey.klimov-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=klimov.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).