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 <davej@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9548b209a3
commit
bd6cba53c5
|
@ -841,20 +841,26 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
|
||||||
drv_attr = cpufreq_driver->attr;
|
drv_attr = cpufreq_driver->attr;
|
||||||
while ((drv_attr) && (*drv_attr)) {
|
while ((drv_attr) && (*drv_attr)) {
|
||||||
ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
|
ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
unlock_policy_rwsem_write(cpu);
|
||||||
goto err_out_driver_exit;
|
goto err_out_driver_exit;
|
||||||
|
}
|
||||||
drv_attr++;
|
drv_attr++;
|
||||||
}
|
}
|
||||||
if (cpufreq_driver->get){
|
if (cpufreq_driver->get){
|
||||||
ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
|
ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
unlock_policy_rwsem_write(cpu);
|
||||||
goto err_out_driver_exit;
|
goto err_out_driver_exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (cpufreq_driver->target){
|
if (cpufreq_driver->target){
|
||||||
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
|
ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
unlock_policy_rwsem_write(cpu);
|
||||||
goto err_out_driver_exit;
|
goto err_out_driver_exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&cpufreq_driver_lock, flags);
|
spin_lock_irqsave(&cpufreq_driver_lock, flags);
|
||||||
for_each_cpu_mask(j, policy->cpus) {
|
for_each_cpu_mask(j, policy->cpus) {
|
||||||
|
|
Loading…
Reference in New Issue