diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6f23ebb395f1..e35a886e00bc 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy) | |||
1530 | { | 1530 | { |
1531 | unsigned int ret_freq = 0; | 1531 | unsigned int ret_freq = 0; |
1532 | 1532 | ||
1533 | if (!cpufreq_driver->get) | 1533 | if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get) |
1534 | return ret_freq; | 1534 | return ret_freq; |
1535 | 1535 | ||
1536 | ret_freq = cpufreq_driver->get(policy->cpu); | 1536 | ret_freq = cpufreq_driver->get(policy->cpu); |
1537 | 1537 | ||
1538 | /* | 1538 | /* |
1539 | * Updating inactive policies is invalid, so avoid doing that. Also | 1539 | * If fast frequency switching is used with the given policy, the check |
1540 | * if fast frequency switching is used with the given policy, the check | ||
1541 | * against policy->cur is pointless, so skip it in that case too. | 1540 | * against policy->cur is pointless, so skip it in that case too. |
1542 | */ | 1541 | */ |
1543 | if (unlikely(policy_is_inactive(policy)) || policy->fast_switch_enabled) | 1542 | if (policy->fast_switch_enabled) |
1544 | return ret_freq; | 1543 | return ret_freq; |
1545 | 1544 | ||
1546 | if (ret_freq && policy->cur && | 1545 | if (ret_freq && policy->cur && |
@@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
1569 | 1568 | ||
1570 | if (policy) { | 1569 | if (policy) { |
1571 | down_read(&policy->rwsem); | 1570 | down_read(&policy->rwsem); |
1572 | 1571 | ret_freq = __cpufreq_get(policy); | |
1573 | if (!policy_is_inactive(policy)) | ||
1574 | ret_freq = __cpufreq_get(policy); | ||
1575 | |||
1576 | up_read(&policy->rwsem); | 1572 | up_read(&policy->rwsem); |
1577 | 1573 | ||
1578 | cpufreq_cpu_put(policy); | 1574 | cpufreq_cpu_put(policy); |