MLK-14668 cpufreq: interactive: check index before using it
This also fixes the following warning: drivers/cpufreq/cpufreq_interactive.c: In function 'choose_freq': drivers/cpufreq/cpufreq_interactive.c:284:7: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] if (ret) ^ Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>steinar/wifi_calib_4_9_kernel
parent
9c0059ad51
commit
0d1f158226
|
@ -255,7 +255,7 @@ static unsigned int choose_freq(struct interactive_cpu *icpu,
|
|||
struct cpufreq_frequency_table *freq_table = policy->freq_table;
|
||||
unsigned int prevfreq, freqmin = 0, freqmax = UINT_MAX, tl;
|
||||
unsigned int freq = policy->cur;
|
||||
int index, ret;
|
||||
int index;
|
||||
|
||||
do {
|
||||
prevfreq = freq;
|
||||
|
@ -268,6 +268,8 @@ static unsigned int choose_freq(struct interactive_cpu *icpu,
|
|||
|
||||
index = cpufreq_frequency_table_target(policy, loadadjfreq / tl,
|
||||
CPUFREQ_RELATION_L);
|
||||
if (index < 0)
|
||||
break;
|
||||
|
||||
freq = freq_table[index].frequency;
|
||||
|
||||
|
@ -281,7 +283,7 @@ static unsigned int choose_freq(struct interactive_cpu *icpu,
|
|||
/* Find highest frequency that is less than freqmax */
|
||||
index = cpufreq_frequency_table_target(policy,
|
||||
freqmax - 1, CPUFREQ_RELATION_H);
|
||||
if (ret)
|
||||
if (index < 0)
|
||||
break;
|
||||
|
||||
freq = freq_table[index].frequency;
|
||||
|
@ -305,7 +307,7 @@ static unsigned int choose_freq(struct interactive_cpu *icpu,
|
|||
/* Find lowest frequency that is higher than freqmin */
|
||||
index = cpufreq_frequency_table_target(policy,
|
||||
freqmin + 1, CPUFREQ_RELATION_L);
|
||||
if (ret)
|
||||
if (index < 0)
|
||||
break;
|
||||
|
||||
freq = freq_table[index].frequency;
|
||||
|
|
Loading…
Reference in New Issue