summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-05-05 19:13:52 +0000
committerjhb <jhb@FreeBSD.org>2008-05-05 19:13:52 +0000
commit4fb93663e6a44fb3530d1bfd400bf14fbd144028 (patch)
treeac1b00a82703d4cb879d23417b319174db5f9bab
parent2ad219aa54ae0dd6df17a319286e834f57a26728 (diff)
downloadFreeBSD-src-4fb93663e6a44fb3530d1bfd400bf14fbd144028.zip
FreeBSD-src-4fb93663e6a44fb3530d1bfd400bf14fbd144028.tar.gz
Fix a few edge cases with error handling in cpufreq(4)'s CPUFREQ_GET()
method: - If the last of the child cpufreq drivers returns an error while trying to fetch its list of supported frequencies but an earlier driver found the requested frequency, don't return an error to the caller. - If all of the child cpufreq drivers fail and the attempt to match the frequency based on 'cpu_est_clockrate()' fails, return ENXIO rather than returning success and returning a frequency of CPUFREQ_VAL_UNKNOWN. MFC after: 3 days PR: kern/121433 Reported by: Eugene Grosbein eugen ! kuzbass dot ru
-rw-r--r--sys/kern/kern_cpu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c
index f8f8c36..50fff53 100644
--- a/sys/kern/kern_cpu.c
+++ b/sys/kern/kern_cpu.c
@@ -452,8 +452,7 @@ cf_get_method(device_t dev, struct cf_level *level)
for (n = 0; n < numdevs && curr_set->freq == CPUFREQ_VAL_UNKNOWN; n++) {
if (!device_is_attached(devs[n]))
continue;
- error = CPUFREQ_DRV_GET(devs[n], &set);
- if (error)
+ if (CPUFREQ_DRV_GET(devs[n], &set) != 0)
continue;
for (i = 0; i < count; i++) {
if (CPUFREQ_CMP(set.freq, levels[i].total_set.freq)) {
@@ -483,9 +482,10 @@ cf_get_method(device_t dev, struct cf_level *level)
if (CPUFREQ_CMP(rate, levels[i].total_set.freq)) {
sc->curr_level = levels[i];
CF_DEBUG("get estimated freq %d\n", curr_set->freq);
- break;
+ goto out;
}
}
+ error = ENXIO;
out:
if (error == 0)
OpenPOWER on IntegriCloud