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 <gauravjindal1104@gmail.com> [ rjw : Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
30a7acd573
commit
3cfd68b5ba
|
@ -36,14 +36,15 @@ static struct cpuidle_governor * __cpuidle_find_governor(const char *str)
|
||||||
/**
|
/**
|
||||||
* cpuidle_switch_governor - changes the governor
|
* cpuidle_switch_governor - changes the governor
|
||||||
* @gov: the new target governor
|
* @gov: the new target governor
|
||||||
*
|
|
||||||
* NOTE: "gov" can be NULL to specify disabled
|
|
||||||
* Must be called with cpuidle_lock acquired.
|
* Must be called with cpuidle_lock acquired.
|
||||||
*/
|
*/
|
||||||
int cpuidle_switch_governor(struct cpuidle_governor *gov)
|
int cpuidle_switch_governor(struct cpuidle_governor *gov)
|
||||||
{
|
{
|
||||||
struct cpuidle_device *dev;
|
struct cpuidle_device *dev;
|
||||||
|
|
||||||
|
if (!gov)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (gov == cpuidle_curr_governor)
|
if (gov == cpuidle_curr_governor)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue