diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-07-15 11:44:00 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2010-08-03 13:47:02 -0400 |
commit | 6ebdf777ba034d2b54c99f28a4b18dabf286d8e5 (patch) | |
tree | 7e8f56588cbb44657a801a23e1589308f0cc553e | |
parent | 0d9715d64fe118dd0957a29e344972b8d3f960e7 (diff) |
[CPUFREQ] Fix PCC driver error path
The PCC cpufreq driver unmaps the mailbox address range if any CPUs fail to
initialise, but doesn't do anything to remove the registered CPUs from the
cpufreq core resulting in failures further down the line. We're better off
simply returning a failure - the cpufreq core will unregister us cleanly if
we end up with no successfully registered CPUs. Tidy up the failure path
and also add a sanity check to ensure that the firmware gives us a realistic
frequency - the core deals badly with that being set to 0.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Naga Chumbalkar <nagananda.chumbalkar@hp.com>
Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c index 900702888bf..a36de5bbb62 100644 --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | |||
@@ -541,13 +541,13 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
541 | 541 | ||
542 | if (!pcch_virt_addr) { | 542 | if (!pcch_virt_addr) { |
543 | result = -1; | 543 | result = -1; |
544 | goto pcch_null; | 544 | goto out; |
545 | } | 545 | } |
546 | 546 | ||
547 | result = pcc_get_offset(cpu); | 547 | result = pcc_get_offset(cpu); |
548 | if (result) { | 548 | if (result) { |
549 | dprintk("init: PCCP evaluation failed\n"); | 549 | dprintk("init: PCCP evaluation failed\n"); |
550 | goto free; | 550 | goto out; |
551 | } | 551 | } |
552 | 552 | ||
553 | policy->max = policy->cpuinfo.max_freq = | 553 | policy->max = policy->cpuinfo.max_freq = |
@@ -556,14 +556,15 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
556 | ioread32(&pcch_hdr->minimum_frequency) * 1000; | 556 | ioread32(&pcch_hdr->minimum_frequency) * 1000; |
557 | policy->cur = pcc_get_freq(cpu); | 557 | policy->cur = pcc_get_freq(cpu); |
558 | 558 | ||
559 | if (!policy->cur) { | ||
560 | dprintk("init: Unable to get current CPU frequency\n"); | ||
561 | result = -EINVAL; | ||
562 | goto out; | ||
563 | } | ||
564 | |||
559 | dprintk("init: policy->max is %d, policy->min is %d\n", | 565 | dprintk("init: policy->max is %d, policy->min is %d\n", |
560 | policy->max, policy->min); | 566 | policy->max, policy->min); |
561 | 567 | out: | |
562 | return 0; | ||
563 | free: | ||
564 | pcc_clear_mapping(); | ||
565 | free_percpu(pcc_cpu_info); | ||
566 | pcch_null: | ||
567 | return result; | 568 | return result; |
568 | } | 569 | } |
569 | 570 | ||