[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DFED112.50903@jp.fujitsu.com>
Date: Mon, 20 Jun 2011 13:48:18 +0900
From: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
To: Borislav Petkov <bp@...64.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
"Luck, Tony" <tony.luck@...el.com>
Subject: Re: [PATCH 5/8] x86, mce: introduce mce_sysdev_init()
(2011/06/18 1:32), Borislav Petkov wrote:
>> @@ -1953,6 +1953,39 @@ static __cpuinit void mce_sysdev_remove(unsigned int cpu)
>> cpumask_clear_cpu(cpu, mce_sysdev_initialized);
>> }
>>
>> +static __init int mce_sysdev_init(void)
>> +{
>> + int err, i;
>> +
>> + zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL);
>> +
>> + /* init attributes for each mce_banks */
>> + for (i = 0; i < banks; i++) {
>> + struct mce_bank *b = &mce_banks[i];
>> + struct sysdev_attribute *a = &b->attr;
>> +
>> + sysfs_attr_init(&a->attr);
>> + a->attr.name = b->attrname;
>> + snprintf(b->attrname, ATTR_LEN, "bank%d", i);
>> +
>> + a->attr.mode = 0644;
>> + a->show = show_bank;
>> + a->store = set_bank;
>> + }
>> +
>> + err = sysdev_class_register(&mce_sysdev_class);
>> + if (err)
>> + return err;
>> +
>> + for_each_online_cpu(i) {
>> + err = mce_sysdev_create(i);
>> + if (err)
>> + return err;
>> + }
>
> Yeah, let's handle the error case here and unwind to a sane state:
>
> if (err)
> goto sysdev_unwind;
> ...
>
> sysdev_unwind:
> while (--i > 0)
> mce_sysdev_remove(i);
>
Nice!
I'll do it.
Thanks,
H.Seto
--
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