• Catalin Marinas's avatar
    cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE · 9bd616e3
    Catalin Marinas authored
    The cpuidle_devices per-CPU variable is only defined when CPU_IDLE is
    enabled. Commit c8cc7d4d
     ("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
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>