Skip to content

Commit 6a4fec4

Browse files
Liao Changvireshk
authored andcommitted
cpufreq: cppc: cppc_cpufreq_get_rate() returns zero in all error cases.
The cpufreq framework used to use the zero of return value to reflect the cppc_cpufreq_get_rate() had failed to get current frequecy and treat all positive integer to be succeed. Since cppc_get_perf_ctrs() returns a negative integer in error case, so it is better to convert the value to zero as the return value of cppc_cpufreq_get_rate(). Signed-off-by: Liao Chang <liaochang1@huawei.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent ba6ea77 commit 6a4fec4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,13 +849,13 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
849849

850850
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
851851
if (ret)
852-
return ret;
852+
return 0;
853853

854854
udelay(2); /* 2usec delay between sampling */
855855

856856
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1);
857857
if (ret)
858-
return ret;
858+
return 0;
859859

860860
delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0,
861861
&fb_ctrs_t1);

include/linux/cpufreq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ struct cpufreq_driver {
370370
int (*target_intermediate)(struct cpufreq_policy *policy,
371371
unsigned int index);
372372

373-
/* should be defined, if possible */
373+
/* should be defined, if possible, return 0 on error */
374374
unsigned int (*get)(unsigned int cpu);
375375

376376
/* Called to update policy limits on firmware notifications. */

0 commit comments

Comments
 (0)