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

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index cc556a8..bb486b4 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -173,6 +173,11 @@
 		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--;