[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] xen/mce: don't issue error message for failed /dev/mcelog registration
On 13/06/17 18:31, Joe Perches wrote: > On Tue, 2017-06-13 at 18:13 +0200, Juergen Gross wrote: >> On 13/06/17 17:20, Ingo Molnar wrote: >>> * Juergen Gross <jgross@xxxxxxxx> wrote: >>> >>>> When running under Xen as dom0 /dev/mcelog is being registered by Xen >>>> instead of the normal mcelog driver. Avoid an error message being >>>> issued by the mcelog driver in this case. Instead issue an informative >>>> message that Xen has registered the device. > [] >>>> diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c >>>> b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c > [] >>>> @@ -388,9 +388,16 @@ static __init int dev_mcelog_init_device(void) >>>> /* register character device /dev/mcelog */ >>>> err = misc_register(&mce_chrdev_device); >>>> if (err) { >>>> - pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err); >>>> - return err; >>>> + if (err == -EBUSY) >>>> + /* Xen dom0 might have registered the device already. */ >>>> + pr_info("Unable to init device /dev/mcelog, already >>>> registered"); >>>> + else { >>>> + pr_err("Unable to init device /dev/mcelog (rc: %d)\n", >>>> + err); >>>> + return err; >>>> + } >>> >>> Please only use balanced curly braces in conditional statements. >> >> Okay, will change. > > Perhaps better is to reverse the test > > if (err != -EBUSY) { > pr_err("Unable to ....", err); > return err; > } > pr_info("etc..."); Okay. > > [ rest of code at this indentation ] > > but it looks like you added a logic defect too and > this code should be: > > if (err) { > if (err == -EBUSY) > pr_info(...) > else > pr_err(...) > return err; > } > > or less indented using > > err = misc_register(&mce_chrdev_device); > if (err == -EBUSY) { > pr_info(...); > return err; > } else if (err) { > pr_err(...); > return err; > } I didn't want to omit the call to mce_register_decode_chain() in the Xen case. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |