Thermal cpu cooling: return error if no valid cpu frequency entry
authorZhang Rui <rui.zhang@intel.com>
Thu, 2 Jan 2014 03:57:48 +0000 (11:57 +0800)
committerAlex Shi <alex.shi@linaro.org>
Thu, 25 Sep 2014 09:02:23 +0000 (17:02 +0800)
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

index 3331b1a12f8520dbf31d8ce737fa21cf47c7540a..e1f0830835e51fda8d1d9276ea9269915beb429c 100644 (file)
@@ -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--;