When booting kernel with mce=off a loud warning from the mce code
is displayed.  This causes confusion for end users.

Add a check to see if MCE is available before outputting the warning
message.

Signed-off-by: Prarit Bhargava <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 00ef43233e03..943a0c440c55 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2662,7 +2662,8 @@ static __init int mcheck_init_device(void)
        free_cpumask_var(mce_device_initialized);
 
 err_out:
-       pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
+       if (mce_available(&boot_cpu_data))
+               pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err);
 
        return err;
 }
-- 
1.7.9.3

Reply via email to