From 7d2f2820572ca43c54851bca79c520f6fe6de70f Mon Sep 17 00:00:00 2001 From: njl Date: Sun, 19 Aug 2007 20:34:13 +0000 Subject: Use a different loop variable for the inner loop. This previous reuse could have caused a hang, but we got lucky with the available multi-CPU states on actual hardware. Submitted by: Bjorn Koenig Approved by: re MFC after: 3 days --- sys/kern/kern_cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_cpu.c b/sys/kern/kern_cpu.c index 6a72b9c..1b631b9 100644 --- a/sys/kern/kern_cpu.c +++ b/sys/kern/kern_cpu.c @@ -396,7 +396,7 @@ cf_get_method(device_t dev, struct cf_level *level) struct cf_setting *curr_set, set; struct pcpu *pc; device_t *devs; - int count, error, i, numdevs; + int count, error, i, n, numdevs; uint64_t rate; sc = device_get_softc(dev); @@ -443,10 +443,10 @@ cf_get_method(device_t dev, struct cf_level *level) * The estimation code below catches this case though. */ CF_MTX_LOCK(&sc->lock); - for (i = 0; i < numdevs && curr_set->freq == CPUFREQ_VAL_UNKNOWN; i++) { - if (!device_is_attached(devs[i])) + for (n = 0; n < numdevs && curr_set->freq == CPUFREQ_VAL_UNKNOWN; n++) { + if (!device_is_attached(devs[n])) continue; - error = CPUFREQ_DRV_GET(devs[i], &set); + error = CPUFREQ_DRV_GET(devs[n], &set); if (error) continue; for (i = 0; i < count; i++) { -- cgit v1.1