]> git.ipfire.org Git - people/arne_f/kernel.git/commit
perf/x86: Shut up false-positive -Wmaybe-uninitialized warning
authorArnd Bergmann <arnd@arndb.de>
Wed, 19 Jul 2017 12:52:59 +0000 (14:52 +0200)
committerSasha Levin <alexander.levin@microsoft.com>
Sun, 4 Mar 2018 15:28:32 +0000 (10:28 -0500)
commit0052b1d7ab8f0438347b3ada2f09ff1a8282b5b7
treea9887cce9d52d0321d364f28847470da41e0d56f
parentbc9dcdf2b3dfbfb9467854ca8954b79a5b06e51f
perf/x86: Shut up false-positive -Wmaybe-uninitialized warning

[ Upstream commit 11d8b05855f3749bcb6c57e2c4052921b9605c77 ]

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 <peterz@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170719125310.2487451-2-arnd@arndb.de
Link: https://patchwork.kernel.org/patch/9392595/
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
arch/x86/kernel/cpu/perf_event.c