mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Dave Jones <davej@redhat.com>
Cc: cpufreq@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 2/2] powernow-k8: Fix unregister order
Date: Wed, 30 Nov 2011 15:49:55 +0100	[thread overview]
Message-ID: <1322664595-23489-2-git-send-email-bp@amd64.org> (raw)

From: Borislav Petkov <borislav.petkov@amd.com>

When we're CPB capable and have allocated a percpu msrs variable, we
need to first unregister the notifier and then free the msrs because the
notifier touches the said variable which could disappear in-between.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 drivers/cpufreq/powernow-k8.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 1c6d879..c36983e 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1582,7 +1582,7 @@ static int __cpuinit powernowk8_init(void)
 	}
 
 	rv = cpufreq_register_driver(&cpufreq_amd64_driver);
-	if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) {
+	if (rv < 0 && cpb_capable) {
 		unregister_cpu_notifier(&cpb_nb);
 		msrs_free(msrs);
 		msrs = NULL;
@@ -1595,11 +1595,10 @@ static void __exit powernowk8_exit(void)
 {
 	pr_debug("exit\n");
 
-	if (boot_cpu_has(X86_FEATURE_CPB)) {
+	if (cpb_capable) {
+		unregister_cpu_notifier(&cpb_nb);
 		msrs_free(msrs);
 		msrs = NULL;
-
-		unregister_cpu_notifier(&cpb_nb);
 	}
 
 	cpufreq_unregister_driver(&cpufreq_amd64_driver);
-- 
1.7.8.rc0


                 reply	other threads:[~2011-11-30 14:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322664595-23489-2-git-send-email-bp@amd64.org \
    --to=bp@amd64.org \
    --cc=borislav.petkov@amd.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®