Browse Source

Thermal cpu cooling: return error if no valid cpu frequency entry

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Zhang Rui 11 years ago
parent
commit
a116776f7b
1 changed files with 5 additions and 0 deletions
  1. 5 0
      drivers/thermal/cpu_cooling.c

+ 5 - 0
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--;