Catalin Marinas 8a1d3de19b cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
commit 9bd616e3dbedfc103f158197c8ad93678849b1ed upstream.

The cpuidle_devices per-CPU variable is only defined when CPU_IDLE is
enabled. Commit c8cc7d4de7a4 ("sched/idle: Reorganize the idle loop")
removed the #ifdef CONFIG_CPU_IDLE around cpuidle_idle_call() with the
compiler optimising away __this_cpu_read(cpuidle_devices). However, with
CONFIG_UBSAN && !CONFIG_CPU_IDLE, this optimisation no longer happens
and the kernel fails to link since cpuidle_devices is not defined.

This patch introduces an accessor function for the current CPU cpuidle
device (returning NULL when !CONFIG_CPU_IDLE) and uses it in
cpuidle_idle_call().

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-10 07:41:43 -08:00
..
2018-05-30 07:49:17 +02:00
2018-01-23 19:50:10 +01:00
2015-11-04 08:23:51 -05:00
2015-04-12 21:03:31 +02:00
2015-11-23 09:44:58 +01:00
2017-05-20 14:27:02 +02:00
2017-07-05 14:37:19 +02:00
2015-11-05 19:34:48 -08:00
2018-05-16 10:06:47 +02:00