diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-04 16:53:28 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-04 16:53:28 -0400 |
commit | a802ea96454570f3c526dd9d7ad8c706e570444d (patch) | |
tree | 208a8a4c4d31ee2626c25109428483cf433100b7 /drivers/cpuidle/governors | |
parent | 82f663277d0db854e8978e5f89fd88f6df75a4a4 (diff) |
cpuidle: Check the sign of index in cpuidle_reflect()
Avoid calling the governor's ->reflect method if the state index
passed to cpuidle_reflect() is negative.
This allows the analogous check to be dropped from menu_reflect(),
so do that too, and ensures that arbitrary error codes can be
passed to cpuidle_reflect() as the index with no adverse
consequences.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Diffstat (limited to 'drivers/cpuidle/governors')
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index b8a5fa15ca24..22e4463d1787 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -367,9 +367,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
367 | static void menu_reflect(struct cpuidle_device *dev, int index) | 367 | static void menu_reflect(struct cpuidle_device *dev, int index) |
368 | { | 368 | { |
369 | struct menu_device *data = this_cpu_ptr(&menu_devices); | 369 | struct menu_device *data = this_cpu_ptr(&menu_devices); |
370 | |||
370 | data->last_state_idx = index; | 371 | data->last_state_idx = index; |
371 | if (index >= 0) | 372 | data->needs_update = 1; |
372 | data->needs_update = 1; | ||
373 | } | 373 | } |
374 | 374 | ||
375 | /** | 375 | /** |