Subject: Re: linux-next: Tree for July 10 (cpufreq oops)

From: Bartlomiej Zolnierkiewicz <[email-masked]>
Date: Fri, 10 Jul 2009 20:54:37 +0200

On Friday 10 July 2009 07:18:46 Stephen Rothwell wrote:
> Hi all,
> Changes since 20090709:
 
[ this particular problem goes back to next-20090709 ]

From: Bartlomiej Zolnierkiewicz <[email-masked]>
Subject: [PATCH] cpufreq: fix OOPS in __cpufreq_governor()

commit 0d923c15b774bed3491400bae6db50481ac8b9e4 ("[CPUFREQ] Factor out
policy setting from cpufreq_add_dev") accidentally reordered new_policy
setup and policy->governor reset.

Fix it, also update comment to match the function name while at it.

Signed-off-by: Bartlomiej Zolnierkiewicz <[email-masked]>
---
 drivers/cpufreq/cpufreq.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: b/drivers/cpufreq/cpufreq.c
===================================================================
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -896,10 +896,11 @@ int cpufreq_add_dev_interface(unsigned i
 	if (ret)
 		goto err_out_kobj_put;
 
-	policy->governor = NULL; /* to assure that the starting sequence is
-				  * run in cpufreq_set_policy */
+	memcpy(&new_policy, policy, sizeof(new_policy));
+
+	/* assure that the starting sequence is run in __cpufreq_set_policy */
+	policy->governor = NULL;
 
-	memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
 	/* set default policy */
 	ret = __cpufreq_set_policy(policy, &new_policy);
 	policy->user_policy.policy = policy->policy;