Commit 292072c3 authored by Viresh Kumar's avatar Viresh Kumar

cpufreq: cached_resolved_idx can not be negative

It is not possible for cached_resolved_idx to be invalid here as the
cpufreq core always sets index to a positive value.

Change its type to unsigned int and fix qcom usage a bit.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent df320f89
...@@ -538,7 +538,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, ...@@ -538,7 +538,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
policy->cached_target_freq = target_freq; policy->cached_target_freq = target_freq;
if (cpufreq_driver->target_index) { if (cpufreq_driver->target_index) {
int idx; unsigned int idx;
idx = cpufreq_frequency_table_target(policy, target_freq, idx = cpufreq_frequency_table_target(policy, target_freq,
CPUFREQ_RELATION_L); CPUFREQ_RELATION_L);
......
...@@ -112,13 +112,10 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy, ...@@ -112,13 +112,10 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
unsigned int target_freq) unsigned int target_freq)
{ {
void __iomem *perf_state_reg = policy->driver_data; void __iomem *perf_state_reg = policy->driver_data;
int index; unsigned int index;
unsigned long freq; unsigned long freq;
index = policy->cached_resolved_idx; index = policy->cached_resolved_idx;
if (index < 0)
return 0;
writel_relaxed(index, perf_state_reg); writel_relaxed(index, perf_state_reg);
freq = policy->freq_table[index].frequency; freq = policy->freq_table[index].frequency;
......
...@@ -127,7 +127,7 @@ struct cpufreq_policy { ...@@ -127,7 +127,7 @@ struct cpufreq_policy {
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */ /* Cached frequency lookup from cpufreq_driver_resolve_freq. */
unsigned int cached_target_freq; unsigned int cached_target_freq;
int cached_resolved_idx; unsigned int cached_resolved_idx;
/* Synchronization for frequency transitions */ /* Synchronization for frequency transitions */
bool transition_ongoing; /* Tracks transition status */ bool transition_ongoing; /* Tracks transition status */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment