linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
	Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-edac@vger.kernel.org
Subject: Re: [PATCH] x86/mce: Fix initialization error warning
Date: Mon, 16 Jan 2017 22:56:06 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1701162253040.3923@nanos> (raw)
In-Reply-To: <1484603381-15018-1-git-send-email-prarit@redhat.com>

On Mon, 16 Jan 2017, Prarit Bhargava wrote:
> 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.

Sigh.

> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: linux-edac@vger.kernel.org
> ---
>  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);

This is really crap. Why would you check the same condition twice? Just
because it's so much more complicated than doing the obvious:

--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2615,10 +2615,8 @@ static __init int mcheck_init_device(voi
 	enum cpuhp_state hp_online;
 	int err;
 
-	if (!mce_available(&boot_cpu_data)) {
-		err = -EIO;
-		goto err_out;
-	}
+	if (!mce_available(&boot_cpu_data))
+		return -EIO;
 
 	if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
 		err = -ENOMEM;

  reply	other threads:[~2017-01-16 21:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 21:49 [PATCH] x86/mce: Fix initialization error warning Prarit Bhargava
2017-01-16 21:56 ` Thomas Gleixner [this message]
2017-01-16 21:56 ` Borislav Petkov
2017-01-16 22:06   ` Prarit Bhargava
2017-01-16 22:43     ` Borislav Petkov
2017-01-16 23:13       ` Prarit Bhargava
2017-01-16 23:32         ` Borislav Petkov
2017-01-16 23:50           ` Prarit Bhargava
2017-01-17  8:34           ` Thomas Gleixner
2017-01-17  9:08             ` Borislav Petkov
2017-01-17  9:09               ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1701162253040.3923@nanos \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=prarit@redhat.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).