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)
commitadb8049097a9ec4acd09fbd3aa8636199a78df8a
tree53f64a739d15e67245f156603a4a2fbe3be10e94
parenta55aa89aab90fae7c815b0551b07be37db359d76
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