From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965088AbdGTK2g (ORCPT ); Thu, 20 Jul 2017 06:28:36 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50479 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935535AbdGTK2d (ORCPT ); Thu, 20 Jul 2017 06:28:33 -0400 Date: Thu, 20 Jul 2017 03:24:45 -0700 From: tip-bot for Arnd Bergmann Message-ID: Cc: linux-kernel@vger.kernel.org, jpoimboe@redhat.com, alexander.shishkin@linux.intel.com, acme@kernel.org, arnd@arndb.de, mingo@kernel.org, torvalds@linux-foundation.org, luto@kernel.org, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org Reply-To: linux-kernel@vger.kernel.org, jpoimboe@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, arnd@arndb.de, torvalds@linux-foundation.org, mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org In-Reply-To: <20170719125310.2487451-2-arnd@arndb.de> References: <20170719125310.2487451-2-arnd@arndb.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] perf/x86: Shut up false-positive -Wmaybe-uninitialized warning Git-Commit-ID: 11d8b05855f3749bcb6c57e2c4052921b9605c77 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 11d8b05855f3749bcb6c57e2c4052921b9605c77 Gitweb: http://git.kernel.org/tip/11d8b05855f3749bcb6c57e2c4052921b9605c77 Author: Arnd Bergmann AuthorDate: Wed, 19 Jul 2017 14:52:59 +0200 Committer: Ingo Molnar CommitDate: Thu, 20 Jul 2017 10:46:23 +0200 perf/x86: Shut up false-positive -Wmaybe-uninitialized warning The intialization function checks for various failure scenarios, but unfortunately the compiler gets a little confused about the possible combinations, leading to a false-positive build warning when -Wmaybe-uninitialized is set: arch/x86/events/core.c: In function ‘init_hw_perf_events’: arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized] arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized] pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n", We can't actually run into this case, so this shuts up the warning by initializing the variables to a known-invalid state. Suggested-by: Peter Zijlstra Signed-off-by: Arnd Bergmann Cc: Alexander Shishkin Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20170719125310.2487451-2-arnd@arndb.de Link: https://patchwork.kernel.org/patch/9392595/ Signed-off-by: Ingo Molnar --- 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 ff1ea2f..8e3db8f 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -191,8 +191,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 = -1, val_new= ~0; + int i, reg, reg_fail = -1, ret = 0; int bios_fail = 0; int reg_safe = -1;