From: Zhang Rui Date: Thu, 2 Jan 2014 03:57:48 +0000 (+0800) Subject: Thermal cpu cooling: return error if no valid cpu frequency entry X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a116776f7b6052599df0c67db29c30ea9d69d7ee;p=linux.git Thermal cpu cooling: return error if no valid cpu frequency entry Signed-off-by: Zhang Rui --- diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index cc556a8e28427..bb486b4ca48ec 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--;