On Wed, Dec 03, 2014 at 10:40:11AM +0530, Viresh Kumar wrote:
On 3 December 2014 at 05:06, Eduardo Valentin edubezval@gmail.com wrote:
ret = get_property(cpufreq_device, state, &clip_freq, GET_FREQ);
if (ret)
return ret;
clip_freq = cpufreq_device->freq_table[state];
There should be some check for valid state here..
What about this ??
Sounds good to me.
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6bd95bc..6e76417 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -228,6 +228,10 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus); unsigned int clip_freq;
/* Request state should be less than max_level */
if (WARN_ON(state > cpufreq_device->max_level))
return -EINVAL;
/* Check if the old cooling action is same as new cooling action */ if (cpufreq_device->cpufreq_state == state) return 0;