Arnd Bergmann fe8c470ab8 ACPI / power: Avoid maybe-uninitialized warning
gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state()
is enterered at least once, so it assumes that cur_state might not get
initialized:

drivers/acpi/power.c: In function 'acpi_power_get_inferred_state':
drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets the variable to zero at the start of the loop, to ensure that
there is well-defined behavior even for an empty list. This gets rid of
the warning.

The warning first showed up when the -Os flag got removed in a bug fix
patch in linux-4.11-rc5.

I would suggest merging this addon patch on top of that bug fix to avoid
introducing a new warning in the stable kernels.

Fixes: 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing)
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19 22:46:10 +02:00
..
2017-02-22 10:46:44 -08:00
2015-07-08 02:27:32 +02:00
2016-04-27 23:42:57 +02:00
2017-03-01 09:46:02 -08:00
2016-01-04 22:10:30 +01:00
2015-07-08 02:27:32 +02:00
2015-07-08 02:27:32 +02:00
2016-10-10 02:20:43 +02:00
2015-07-08 02:27:32 +02:00
2016-07-19 12:32:39 -07:00