diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 24ddf13214f0..bc6623f13ab5 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1001,7 +1001,7 @@ static ssize_t available_frequencies_show(struct device *d, rcu_read_lock(); use_opp = dev_pm_opp_get_opp_count(dev) > 0; - do { + while (use_opp || (!use_opp && i < max_state)) { if (use_opp) { opp = dev_pm_opp_find_freq_ceil(dev, &freq); if (IS_ERR(opp)) @@ -1013,7 +1013,7 @@ static ssize_t available_frequencies_show(struct device *d, count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), "%lu ", freq); freq++; - } while (use_opp || (!use_opp && i < max_state)); + } rcu_read_unlock(); /* Truncate the trailing space */