aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-01-02 11:57:48 +0800
committerJon Medhurst <tixy@linaro.org>2014-09-24 16:59:28 +0100
commit0a5d1934d88b8797113fd5f6bb7c521d4f1fb11b (patch)
tree6583aa942ec18221e7e8ee8e03763cdd21047f9c
parent771423447242882445322faa62bdc9afb146415e (diff)
Thermal cpu cooling: return error if no valid cpu frequency entrylsk-3.10-armlt-juno-20140924
Signed-off-by: Zhang Rui <rui.zhang@intel.com> (cherry picked from commit a116776f7b6052599df0c67db29c30ea9d69d7ee) Signed-off-by: Jon Medhurst <tixy@linaro.org>
-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 b20b513c9e97..61e3afd16653 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--;