]> git.baikalelectronics.ru Git - kernel.git/commit
tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
authorBen Hutchings <ben@decadent.org.uk>
Sun, 16 Sep 2018 15:05:53 +0000 (16:05 +0100)
committerLen Brown <len.brown@intel.com>
Sat, 31 Aug 2019 18:48:24 +0000 (14:48 -0400)
commitb2f7c0dfcc6720d67e13bfde67097b4a90f0e6a2
tree53f64a739d15e67245f156603a4a2fbe3be10e94
parent105f9378765ab89e50c53551fccbfca94afcdfa2
tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

x86_energy_perf_policy first uses __get_cpuid() to check the maximum
CPUID level and exits if it is too low.  It then assumes that later
calls will succeed (which I think is architecturally guaranteed).  It
also assumes that CPUID works at all (which is not guaranteed on
x86_32).

If optimisations are enabled, gcc warns about potentially
uninitialized variables.  Fix this by adding an exit-on-error after
every call to __get_cpuid() instead of just checking the maximum
level.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c