From: Mike Turquette <mturquette@linaro.org>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>,
Cong Ding <dinggnu@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
linux-kernel@vger.kernel.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3] clk: mvebu/clk-cpu.c: fix memory leakage
Date: Tue, 15 Jan 2013 17:01:43 -0800 [thread overview]
Message-ID: <20130116010143.8920.90024@quantum> (raw)
In-Reply-To: <50F5C00B.10108@free-electrons.com>
Quoting Gregory CLEMENT (2013-01-15 12:46:03)
> On 01/15/2013 07:44 PM, Cong Ding wrote:
> > the variable cpuclk and clk_name should be properly freed when error happens.
> Dear Cong Ding,
>
> Thanks for you efforts!
> I am happy with this patch and I tested it on the Armada XP DB board, so
> you can now add my:
>
> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
>
> Mike,
>
> could you take this patch for 3.8-rc fixes?
>
> If you prefer, Jason agrees to take it, but you probably didn't notice it,
> because he uses your former(and no more valid) email when he wrote this.
>
Acked-by: Mike Turquette <mturquette@linaro.org>
I don't have an existing clk-fixes branch. This patch is the first fix
I've reviewed for this cycle. I'm happy if you want to take it and
submit as part of any other mvebu fixes you have. Otherwise I can take
it.
Let me know what you decide.
Thanks,
Mike
> Thanks,
>
> Gregory
>
> >
> > Signed-off-by: Cong Ding <dinggnu@gmail.com>
> > Acked-by: Jason Cooper <jason@lakedaemon.net>
> > ---
> > drivers/clk/mvebu/clk-cpu.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
> > index ff004578..9dd2551 100644
> > --- a/drivers/clk/mvebu/clk-cpu.c
> > +++ b/drivers/clk/mvebu/clk-cpu.c
> > @@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
> >
> > clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
> > if (WARN_ON(!clks))
> > - return;
> > + goto clks_out;
> >
> > for_each_node_by_type(dn, "cpu") {
> > struct clk_init_data init;
> > @@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
> > int cpu, err;
> >
> > if (WARN_ON(!clk_name))
> > - return;
> > + goto bail_out;
> >
> > err = of_property_read_u32(dn, "reg", &cpu);
> > if (WARN_ON(err))
> > - return;
> > + goto bail_out;
> >
> > sprintf(clk_name, "cpu%d", cpu);
> > parent_clk = of_clk_get(node, 0);
> > @@ -167,6 +167,9 @@ void __init of_cpu_clk_setup(struct device_node *node)
> > return;
> > bail_out:
> > kfree(clks);
> > + while(ncpus--)
> > + kfree(cpuclk[ncpus].clk_name);
> > +clks_out:
> > kfree(cpuclk);
> > }
> >
> >
>
>
> --
> Gregory Clement, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
next prev parent reply other threads:[~2013-01-16 1:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-14 17:18 [PATCH] clk: mvebu/clk-cpu.c: fix memory leakage Cong Ding
2013-01-15 14:13 ` Gregory CLEMENT
2013-01-15 14:41 ` Cong Ding
2013-01-15 15:23 ` [PATCH v2] " Cong Ding
2013-01-15 15:37 ` Jason Cooper
2013-01-15 16:33 ` Gregory CLEMENT
2013-01-15 18:26 ` Cong Ding
2013-01-15 18:36 ` Gregory CLEMENT
2013-01-15 18:44 ` [PATCH v3] " Cong Ding
2013-01-15 20:46 ` Gregory CLEMENT
2013-01-15 20:57 ` Jason Cooper
2013-01-16 1:01 ` Mike Turquette [this message]
2013-01-16 2:00 ` Jason Cooper
2013-01-23 1:08 ` Jason Cooper
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=20130116010143.8920.90024@quantum \
--to=mturquette@linaro.org \
--cc=dinggnu@gmail.com \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/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