From: Zhang Rui rui.zhang@intel.com
Signed-off-by: Zhang Rui rui.zhang@intel.com (cherry picked from commit a116776f7b6052599df0c67db29c30ea9d69d7ee) Signed-off-by: Alex Shi alex.shi@linaro.org --- drivers/thermal/cpu_cooling.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 3331b1a..e1f0830 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--;