Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bd6cba53c524dccf72900435d29722b22f61d835
Commit:     bd6cba53c524dccf72900435d29722b22f61d835
Parent:     9548b209a37397f3036aa5bd3d5b4d3b725aa11a
Author:     Dave Jones <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 17 16:19:58 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Dec 17 19:28:16 2007 -0800

    cpufreq: fix missing unlocks in cpufreq_add_dev error paths.
    
    Ingo hit some BUG_ONs that were probably caused by these missing unlocks
    causing an unbalance.  He couldn't reproduce the bug reliably, so it's
    unknown that it's definitly fixing the problem he hit, but it's a fairly
    good chance, and this fixes an obvious bug.
    
    [ Dave: "Ingo followed up that he hit some lockdep related output with
             this applied, so it may not be right.  I'll look at it after
             xmas if no-one has it figured out before then."
      Akpm: "It looks pretty correct to me though." ]
    
    Signed-off-by: Dave Jones <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/cpufreq/cpufreq.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5e626b1..79581fa 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -841,19 +841,25 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
        drv_attr = cpufreq_driver->attr;
        while ((drv_attr) && (*drv_attr)) {
                ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
                drv_attr++;
        }
        if (cpufreq_driver->get){
                ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
        }
        if (cpufreq_driver->target){
                ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
-               if (ret)
+               if (ret) {
+                       unlock_policy_rwsem_write(cpu);
                        goto err_out_driver_exit;
+               }
        }
 
        spin_lock_irqsave(&cpufreq_driver_lock, flags);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to