summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/driver.c
diff options
context:
space:
mode:
authorXunlei Pang <pang.xunlei@linaro.org>2015-08-31 05:34:05 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-09-03 03:05:47 +0200
commitabceaa9cded5f059f8c3b3b6f32730084fe5e39f (patch)
tree8f4cfa6f48e5ed6b6eee71ba4d2b7c334a705ba9 /drivers/cpuidle/driver.c
parentcpuidle/coupled: Remove redundant 'dev' argument of cpuidle_state_is_coupled() (diff)
downloadlinux-abceaa9cded5f059f8c3b3b6f32730084fe5e39f.tar.xz
linux-abceaa9cded5f059f8c3b3b6f32730084fe5e39f.zip
cpuidle/coupled: Add sanity check for safe_state_index
Since we are using cpuidle_driver::safe_state_index directly as the target state index, it is better to add the sanity check at the point of registering the driver. Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/driver.c')
-rw-r--r--drivers/cpuidle/driver.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 5db147859b90..389ade4572be 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -227,6 +227,10 @@ static int __cpuidle_register_driver(struct cpuidle_driver *drv)
if (!drv || !drv->state_count)
return -EINVAL;
+ ret = cpuidle_coupled_state_verify(drv);
+ if (ret)
+ return ret;
+
if (cpuidle_disabled())
return -ENODEV;