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

Commit 3cfd68b5 authored by gaurav jindal's avatar gaurav jindal Committed by Rafael J. Wysocki
Browse files

cpuidle: Avoid NULL argument in cpuidle_switch_governor()



Checks if the new governor is NULL before updating the
cupidle_curr_governor.

Signed-off-by: default avatargaurav jindal <gauravjindal1104@gmail.com>
[ rjw : Subject ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 30a7acd5
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -36,14 +36,15 @@ static struct cpuidle_governor * __cpuidle_find_governor(const char *str)
/**
 * cpuidle_switch_governor - changes the governor
 * @gov: the new target governor
 *
 * NOTE: "gov" can be NULL to specify disabled
 * Must be called with cpuidle_lock acquired.
 */
int cpuidle_switch_governor(struct cpuidle_governor *gov)
{
	struct cpuidle_device *dev;

	if (!gov)
		return -EINVAL;

	if (gov == cpuidle_curr_governor)
		return 0;