]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
cpufreq: cppc: cppc_cpufreq_get_rate() returns zero in all error cases.
authorLiao Chang <liaochang1@huawei.com>
Tue, 15 Aug 2023 01:40:17 +0000 (09:40 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Thu, 17 Aug 2023 08:42:11 +0000 (14:12 +0530)
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>
drivers/cpufreq/cppc_cpufreq.c
include/linux/cpufreq.h

index 022e3555407c867bd4d0d2508571fedd0f22a0f7..05642759faee24d6bf535988240e7fe18f70b56d 100644 (file)
@@ -849,13 +849,13 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
 
        ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
        if (ret)
-               return ret;
+               return 0;
 
        udelay(2); /* 2usec delay between sampling */
 
        ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1);
        if (ret)
-               return ret;
+               return 0;
 
        delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0,
                                               &fb_ctrs_t1);
index 172ff51c1b2a4b9f310943e78c44793ec5bd4f34..99da27466b8f1c508dca17c18e4be38c1a1d1df2 100644 (file)
@@ -370,7 +370,7 @@ struct cpufreq_driver {
        int             (*target_intermediate)(struct cpufreq_policy *policy,
                                               unsigned int index);
 
-       /* should be defined, if possible */
+       /* should be defined, if possible, return 0 on error */
        unsigned int    (*get)(unsigned int cpu);
 
        /* Called to update policy limits on firmware notifications. */