From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751172AbdALIaG (ORCPT ); Thu, 12 Jan 2017 03:30:06 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:35926 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751040AbdALIaF (ORCPT ); Thu, 12 Jan 2017 03:30:05 -0500 Date: Thu, 12 Jan 2017 09:30:00 +0100 From: Ingo Molnar To: Augusto Mecking Caringi Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf/x86: Fix 'may be used uninitialized' build warnings in core.c Message-ID: <20170112083000.GA10669@gmail.com> References: <1483619607-11722-1-git-send-email-augustocaringi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1483619607-11722-1-git-send-email-augustocaringi@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Augusto Mecking Caringi 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 > --- > 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