Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d09d312 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki
Browse files

cpuidle: call cpuidle_get_driver() from after taking cpuidle_driver_lock



There are a few cpuidle_get_driver() calls that aren't made under
cpuidle_driver_lock which is incorrect.

Fix them by calling cpuidle_get_driver() after taking cpuidle_driver_lock.

Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 6d281e97
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -338,10 +338,11 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
 */
 */
void cpuidle_driver_unref(void)
void cpuidle_driver_unref(void)
{
{
	struct cpuidle_driver *drv = cpuidle_get_driver();
	struct cpuidle_driver *drv;


	spin_lock(&cpuidle_driver_lock);
	spin_lock(&cpuidle_driver_lock);


	drv = cpuidle_get_driver();
	if (drv && !WARN_ON(drv->refcnt <= 0))
	if (drv && !WARN_ON(drv->refcnt <= 0))
		drv->refcnt--;
		drv->refcnt--;


+2 −1
Original line number Original line Diff line number Diff line
@@ -52,9 +52,10 @@ static ssize_t show_current_driver(struct device *dev,
				   char *buf)
				   char *buf)
{
{
	ssize_t ret;
	ssize_t ret;
	struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver();
	struct cpuidle_driver *cpuidle_driver;


	spin_lock(&cpuidle_driver_lock);
	spin_lock(&cpuidle_driver_lock);
	cpuidle_driver = cpuidle_get_driver();
	if (cpuidle_driver)
	if (cpuidle_driver)
		ret = sprintf(buf, "%s\n", cpuidle_driver->name);
		ret = sprintf(buf, "%s\n", cpuidle_driver->name);
	else
	else