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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Sep 2019 05:17:08 +0000 (07:17 +0200)
commit254b9b2971a71ddaa3623cd665bbebc862a05937
tree23b59705e952f96102cb0e4f03acaa5b42a450c2
parenta85a0d9f37964b1f721764de6092acc1e19dc466
tools/power x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

[ Upstream commit adb8049097a9ec4acd09fbd3aa8636199a78df8a ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c