summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/cpuidle.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-05-04 22:53:28 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-05-04 22:53:28 +0200
commita802ea96454570f3c526dd9d7ad8c706e570444d (patch)
tree208a8a4c4d31ee2626c25109428483cf433100b7 /drivers/cpuidle/cpuidle.c
parent82f663277d0db854e8978e5f89fd88f6df75a4a4 (diff)
downloadlinux-a802ea96454570f3c526dd9d7ad8c706e570444d.tar.gz
linux-a802ea96454570f3c526dd9d7ad8c706e570444d.tar.bz2
linux-a802ea96454570f3c526dd9d7ad8c706e570444d.zip
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/cpuidle.c')
-rw-r--r--drivers/cpuidle/cpuidle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 61c417b9e53f..3b80b77a585d 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -249,7 +249,7 @@ int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev,
*/
void cpuidle_reflect(struct cpuidle_device *dev, int index)
{
- if (cpuidle_curr_governor->reflect)
+ if (cpuidle_curr_governor->reflect && index >= 0)
cpuidle_curr_governor->reflect(dev, index);
}