LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Balaji Rao <balajirrao@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@suse.de
Subject: [REGRESSION] kobject handling in cpufreq
Date: Sat, 9 Feb 2008 00:52:40 +0530	[thread overview]
Message-ID: <200802090052.40939.balajirrao@gmail.com> (raw)

Hi greg,

I encountered a regression in linux-2.6.git which prevented the system from shutting down. I found that it 
was 'waiting_for_completion' on kobj_unregister.The same thing happened when I tried to take CPUs offline.

git-bisect pointed me to this commit :

commit c10997f6575f476ff38442fa18fd4a0d80345f9d
Author: Greg Kroah-Hartman <gregkh@suse.de>
Date:   Thu Dec 20 08:13:05 2007 -0800

    Kobject: convert drivers/* from kobject_unregister() to kobject_put()

In the file drivers/cpufreq/cpufreq.c, you have not replaced one occurrence of kobject_unregister with kobject_put. 
Apparently its because of the kobject_put in the subsequent line.

@@ -1030,8 +1030,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
 
        unlock_policy_rwsem_write(cpu);
 
-       kobject_unregister(&data->kobj);
-
        kobject_put(&data->kobj);
 
        /* we need to make sure that the underlying kobj is actually

Now, this can be fixed by adding another kobject_put. But having two kobject_puts in consequent lines tells us that there 
should be two references to the kobject at that point. So, I believe that it is safe to remove the kobject_get 
corresponding to the existing kobject_put to fix this.

Signed-off-by: Balaji Rao <balajirrao@gmail.com>

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 64926aa..2158786 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1004,17 +1004,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
 		unlock_policy_rwsem_write(cpu);
 		return 0;
 	}
-#endif
-
-
-	if (!kobject_get(&data->kobj)) {
-		spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
-		cpufreq_debug_enable_ratelimit();
-		unlock_policy_rwsem_write(cpu);
-		return -EFAULT;
-	}
-
-#ifdef CONFIG_SMP
 
 #ifdef CONFIG_HOTPLUG_CPU
 	cpufreq_cpu_governor[cpu] = data->governor;
-- 
regards,
balaji rao

             reply	other threads:[~2008-02-08 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 19:22 Balaji Rao [this message]
2008-02-08 19:39 ` Greg KH

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=200802090052.40939.balajirrao@gmail.com \
    --to=balajirrao@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [REGRESSION] kobject handling in cpufreq' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).