[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51DB5A22.9080307@asianux.com>
Date: Tue, 09 Jul 2013 08:32:34 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Wang YanQing <udknight@...il.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
lig.fnst@...fujitsu.com, chuansheng.liu@...el.com,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/smp.c: free related resources when failure occurs
in hotplug_cfd()
On 07/09/2013 08:28 AM, Wang YanQing wrote:
> On Mon, Jul 08, 2013 at 04:50:24PM +0800, Chen Gang wrote:
>> > When failure occurs in hotplug_cfd(), need release related resources,
>> > or will cause memory leak.
>> >
>> > Also beautify the related code.
>> >
>> > Signed-off-by: Chen Gang <gang.chen@...anux.com>
>> > ---
>> > kernel/smp.c | 13 +++++++++----
>> > 1 files changed, 9 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/kernel/smp.c b/kernel/smp.c
>> > index 02a885d..c264623 100644
>> > --- a/kernel/smp.c
>> > +++ b/kernel/smp.c
>> > @@ -45,15 +45,20 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
>> > switch (action) {
>> > case CPU_UP_PREPARE:
>> > case CPU_UP_PREPARE_FROZEN:
>> > - if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
>> > - cpu_to_node(cpu)))
>> > + if (!zalloc_cpumask_var_node(&cfd->cpumask,
>> > + GFP_KERNEL, cpu_to_node(cpu)))
>> > return notifier_from_errno(-ENOMEM);
> What did you fixed here? code style?
> You can drop this part.
>
Yes, I should drop.
>> > - if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
>> > - cpu_to_node(cpu)))
>> > +
>> > + if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi,
>> > + GFP_KERNEL, cpu_to_node(cpu))) {
>> > + free_cpumask_var(cfd->cpumask);
>> > return notifier_from_errno(-ENOMEM);
>> > + }
>> > +
>> > cfd->csd = alloc_percpu(struct call_single_data);
>> > if (!cfd->csd) {
>> > free_cpumask_var(cfd->cpumask);
>> > + free_cpumask_var(cfd->cpumask_ipi);
>> > return notifier_from_errno(-ENOMEM);
>> > }
>> > break;
> Yes, we need this fix.
>
> If you resend the v2, I will give acked-by :)
Thanks.
--
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists