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

Commit 3b9c10e9 authored by Daniel Fu's avatar Daniel Fu Committed by Rafael J. Wysocki
Browse files

cpuidle: Check the result of cpuidle_get_driver() against NULL



If the current CPU has no cpuidle driver, drv will be NULL in
cpuidle_driver_ref().  Check if that is the case before trying
to bump up the driver's refcount to prevent the kernel from
crashing.

[rjw: Subject and changelog]
Signed-off-by: default avatarDaniel Fu <danifu@nvidia.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 9e19b73c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -331,6 +331,7 @@ struct cpuidle_driver *cpuidle_driver_ref(void)
	spin_lock(&cpuidle_driver_lock);

	drv = cpuidle_get_driver();
	if (drv)
		drv->refcnt++;

	spin_unlock(&cpuidle_driver_lock);