From: gaurav jindal Date: Fri, 5 Jan 2018 13:01:30 +0000 (+0100) Subject: cpuidle: Avoid NULL argument in cpuidle_switch_governor() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3cfd68b5ba8737d28bfcf9b6487ea4d9216b8504;p=linux.git cpuidle: Avoid NULL argument in cpuidle_switch_governor() Checks if the new governor is NULL before updating the cupidle_curr_governor. Signed-off-by: gaurav jindal [ rjw : Subject ] Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c index 4e78263e34a47..5d359aff3cc53 100644 --- a/drivers/cpuidle/governor.c +++ b/drivers/cpuidle/governor.c @@ -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;