RE: [PATCH] cpufreq: Fix PCC driver error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

>-----Original Message-----
>From: Matthew Garrett [mailto:mjg@xxxxxxxxxx] 
>Sent: Thursday, July 15, 2010 10:44 AM
>To: davej@xxxxxxxxxx
>Cc: cpufreq@xxxxxxxxxxxxxxx; Matthew Garrett; Chumbalkar, Nagananda
>Subject: [PATCH] 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@xxxxxxxxxx>
>Cc: Naga Chumbalkar <nagananda.chumbalkar@xxxxxx>

This patch is good.

- naga -


>---
> 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 ce7cde7..b3c4df2 100644
>--- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
>+++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
>@@ -543,13 +543,13 @@ static int pcc_cpufreq_cpu_init(struct 
>cpufreq_policy *policy)
> 
> 	if (!pcch_virt_addr) {
> 		result = -1;
>-		goto pcch_null;
>+		goto out;
> 	}
> 
> 	result = pcc_get_offset(cpu);
> 	if (result) {
> 		dprintk("init: PCCP evaluation failed\n");
>-		goto free;
>+		goto out;
> 	}
> 
> 	policy->max = policy->cpuinfo.max_freq =
>@@ -558,14 +558,15 @@ static int pcc_cpufreq_cpu_init(struct 
>cpufreq_policy *policy)
> 		ioread32(&pcch_hdr->minimum_frequency) * 1000;
> 	policy->cur = pcc_get_freq(cpu);
> 
>+	if (!policy->cur) {
>+		dprintk("init: Unable to get current CPU frequency\n");
>+		result = -EINVAL;
>+		goto out;
>+	}
>+
> 	dprintk("init: policy->max is %d, policy->min is %d\n",
> 		policy->max, policy->min);
>-
>-	return 0;
>-free:
>-	pcc_clear_mapping();
>-	free_percpu(pcc_cpu_info);
>-pcch_null:
>+out:
> 	return result;
> }
> 
>-- 
>1.7.1
>
>--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux