cpufreq: interactive: Fix potential division by zero

This commit is contained in:
Steve Kondik 2010-11-05 11:31:36 -04:00 committed by Jon Benson
parent c69e698fff
commit c8cec4c0c1

View File

@ -171,6 +171,9 @@ static unsigned int cpufreq_interactive_calc_freq(unsigned int cpu)
idle_time = (unsigned int) current_idle_time - freq_change_time_in_idle;
delta_time = (unsigned int) current_wall_time - freq_change_time;
if (delta_time == 0)
return policy->cur;
cpu_load = 100 * (delta_time - idle_time) / delta_time;
return policy->cur * cpu_load / 100;