]> git.baikalelectronics.ru Git - kernel.git/commit
cpuidle: Fix cpuidle_driver_state_disabled()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 10 Dec 2019 11:48:35 +0000 (12:48 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 10 Dec 2019 22:41:20 +0000 (23:41 +0100)
commit51445b7d5dfa18c59c45c44809da7a7233134c8d
treed5e9cfeb7782e390392c0956ed9b12e9744fdd8c
parenteb9d2937b7b3482bd1027d5cbc8aee7b7d485299
cpuidle: Fix cpuidle_driver_state_disabled()

It turns out that cpuidle_driver_state_disabled() can be called
before registering the cpufreq driver on some platforms, which
was not expected when it was introduced and which leads to a NULL
pointer dereference when trying to walk the CPUs associated with
the given cpuidle driver.

Fix the problem by making cpuidle_driver_state_disabled() check if
the driver's mask of CPUs associated with it is present and to set
CPUIDLE_FLAG_UNUSABLE for the given idle state in the driver's states
list if that is not the case to cause __cpuidle_register_device() to
set CPUIDLE_STATE_DISABLED_BY_DRIVER for that state for all cpuidle
devices registered by it later.

Fixes: 0894d56ef505 ("cpuidle: Introduce cpuidle_driver_state_disabled() for driver quirks")
Reported-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/driver.c