aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-01-02 11:57:48 +0800
committerAlex Shi <alex.shi@linaro.org>2014-09-25 17:02:23 +0800
commit25a434675eaa351f90b51866a982accac5ee6c61 (patch)
tree00c73d07499de04473db0e768d187d8086b3e5d4
parente86c742e299cbe321870aa00bcbd4985d1f628fe (diff)
Thermal cpu cooling: return error if no valid cpu frequency entry
Signed-off-by: Zhang Rui <rui.zhang@intel.com> (cherry picked from commit a116776f7b6052599df0c67db29c30ea9d69d7ee) Signed-off-by: Alex Shi <alex.shi@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 3331b1a12f85..e1f0830835e5 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--;