summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2010-01-07 10:47:32 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2010-01-07 10:47:32 +1100
commitcaa7885ad527142d90b2da1462c7c57aaede2c48 (patch)
treea2fa1373838c278f5dfe9005ecd389d582a48e92 /drivers
parent38edc39e1ae9d7071f99b6964c10c0e4e797f682 (diff)
parent8e196da6b8e15e27af67ea6c9a01a888ae97b8b4 (diff)
Merge remote branch 'cpufreq-current/fixes'
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/cpufreq.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 67bc2ece7b4b..3fbffd11d989 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1811,19 +1811,21 @@ error_out:
*/
int cpufreq_update_policy(unsigned int cpu)
{
- struct cpufreq_policy *data = cpufreq_cpu_get(cpu);
+ struct cpufreq_policy *data;
struct cpufreq_policy policy;
int ret;
- if (!data) {
- ret = -ENODEV;
- goto no_policy;
- }
-
if (unlikely(lock_policy_rwsem_write(cpu))) {
ret = -EINVAL;
goto fail;
}
+ data = cpufreq_cpu_get(cpu);
+
+ if (!data) {
+ dprintk("Update: No policy on cpu: %u\n", cpu);
+ ret = -ENODEV;
+ goto no_policy;
+ }
dprintk("updating policy for CPU %u\n", cpu);
memcpy(&policy, data, sizeof(struct cpufreq_policy));
@@ -1848,11 +1850,10 @@ int cpufreq_update_policy(unsigned int cpu)
ret = __cpufreq_set_policy(data, &policy);
- unlock_policy_rwsem_write(cpu);
-
-fail:
cpufreq_cpu_put(data);
no_policy:
+ unlock_policy_rwsem_write(cpu);
+fail:
return ret;
}
EXPORT_SYMBOL(cpufreq_update_policy);