From: Ingo Molnar <mingo@kernel.org>
To: Augusto Mecking Caringi <augustocaringi@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/x86: Fix 'may be used uninitialized' build warnings in core.c
Date: Thu, 12 Jan 2017 09:30:00 +0100 [thread overview]
Message-ID: <20170112083000.GA10669@gmail.com> (raw)
In-Reply-To: <1483619607-11722-1-git-send-email-augustocaringi@gmail.com>
* Augusto Mecking Caringi <augustocaringi@gmail.com> wrote:
> This patch fixes the following build warnings in core.c:
>
> linux/arch/x86/events/core.c: In function ‘init_hw_perf_events’:
> linux/include/linux/printk.h:292:2: warning: ‘reg_fail’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> ^
> linux/arch/x86/events/core.c:194:14: note: ‘reg_fail’ was declared here
> int i, reg, reg_fail, ret = 0;
>
> linux/include/linux/printk.h:292:2: warning: ‘val_fail’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
> ^
> linux/arch/x86/events/core.c:193:11: note: ‘val_fail’ was declared here
> u64 val, val_fail, val_new= ~0;
>
> Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
> ---
> arch/x86/events/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 019c588..f6e41b4 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -190,8 +190,8 @@ static void release_pmc_hardware(void) {}
>
> static bool check_hw_exists(void)
> {
> - u64 val, val_fail, val_new= ~0;
> - int i, reg, reg_fail, ret = 0;
> + u64 val, val_fail = 0, val_new= ~0;
> + int i, reg, reg_fail = 0, ret = 0;
> int bios_fail = 0;
> int reg_safe = -1;
What's not mentioned in the changelog is whether the warning was right or wrong -
i.e. whether this patch changes behavior or silences a false positive warning.
Whether the compiler changed object code as result of this change would be good to
know as well.
Thanks,
Ingo
prev parent reply other threads:[~2017-01-12 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 12:33 [PATCH] perf/x86: Fix 'may be used uninitialized' build warnings in core.c Augusto Mecking Caringi
2017-01-12 8:30 ` Ingo Molnar [this message]
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=20170112083000.GA10669@gmail.com \
--to=mingo@kernel.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=augustocaringi@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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