summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-01-02 04:57:48 +0100
committerZhang Rui <rui.zhang@intel.com>2014-01-02 04:59:18 +0100
commita116776f7b6052599df0c67db29c30ea9d69d7ee (patch)
treee83cd1cb0bfc10282477e516b83b7ece706ba0e0 /drivers
parentthermal: fix cpu_cooling max_level behavior (diff)
downloadlinux-a116776f7b6052599df0c67db29c30ea9d69d7ee.tar.xz
linux-a116776f7b6052599df0c67db29c30ea9d69d7ee.zip
Thermal cpu cooling: return error if no valid cpu frequency entry
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/thermal/cpu_cooling.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index cc556a8e2842..bb486b4ca48e 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -173,6 +173,11 @@ static int get_property(unsigned int cpu, unsigned long input,
freq = table[i].frequency;
max_level++;
}
+
+ /* No valid cpu frequency entry */
+ if (max_level == 0)
+ return -EINVAL;
+
/* max_level is an index, not a counter */
max_level--;