Skip to content

Commit

Permalink
cpuidle: Avoid NULL argument in cpuidle_switch_governor()
Browse files Browse the repository at this point in the history
Checks if the new governor is NULL before updating the
cupidle_curr_governor.

Signed-off-by: gaurav jindal <[email protected]>
[ rjw : Subject ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
grvjindal100 authored and rafaeljw committed Jan 5, 2018
1 parent 30a7acd commit 3cfd68b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/cpuidle/governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3cfd68b

Please sign in to comment.