Skip to contentSkip to conversation

x86, mce: Print warning if MCE handler fails to register /dev/mcelog

PATCH In review Khalid Aziz 3 participants 4 messages Apr 9, 2013 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, mce: Print warning if MCE handler fails to register /dev/mcelog

Print a warning if machine check handler fails to register /dev/mcelog device.

---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
index 7bc1263..7b4c28c 100644
@@ -2412,7 +2412,8 @@ static __init int mcheck_init_device(void)
 	register_hotcpu_notifier(&mce_cpu_notifier);
 
 	/* register character device /dev/mcelog */
-	misc_register(&mce_chrdev_device);
+	if (misc_register(&mce_chrdev_device) != 0)
+		pr_warn("Failed to register mcelog device\n");
 
 	return err;
 }
Signature · 1 line
1.7.10.4
#1 lore raw

- misc_register(&mce_chrdev_device);
+ if (misc_register(&mce_chrdev_device) != 0)
+ pr_warn("Failed to register mcelog device\n");

Did this actually happen to you? Or is this just "good practice" to check the return value from misc_register?

If this can really happen, we should remember that it failed and just drop out of mce_log() early (no point in queueing up records when there is no way for a user to ever access them).

-Tony ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

maintainer
#2 lore raw
Quoted 6 lines · Tony
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
-	misc_register(&mce_chrdev_device);
+	if (misc_register(&mce_chrdev_device) != 0)
+		pr_warn("Failed to register mcelog device\n");

Did this actually happen to you? Or is this just "good practice" to check the return value from misc_register?

I'm very sceptical this actually happens - we would've otherwise seen reports about mcelog not starting correctly.

Hmm.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#3 lore raw
In reply to Luck, Tony
Quoted 7 lines · Tony
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
-	misc_register(&mce_chrdev_device);
+	if (misc_register(&mce_chrdev_device) != 0)
+		pr_warn("Failed to register mcelog device\n");

Did this actually happen to you? Or is this just "good practice" to check the return value from misc_register?

No, I did not see this happen. It is just "good practice". If it were to happen, mcelog daemon would fail to get any mce records and it will not be easy to figure out what happened. Most other places in kernel where misc_register() is called, do check for return code and take action if it fails.

--
Khalid