[PATCH] Thermal cpu cooling: return error if no valid cpu frequencyentry

From: Zhang Rui
Date: Wed Jan 01 2014 - 22:57:48 EST


Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
---
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 cc556a8..bb486b4 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--;

--
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/