aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-03 19:19:41 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-07 17:02:50 -0400
commit10659ab7b50e963429f1a681882404ca37aa584c (patch)
treea72a4499d7a8034342a4d498ab120b78249bf17d /drivers/cpufreq
parent71c3461ef7c67024792d283b88630245a6c169ba (diff)
cpufreq: Avoid double kobject_put() for the same kobject in error code path
The only case triggering a jump to the err_out_unregister label in __cpufreq_add_dev() is when cpufreq_add_dev_interface() fails. However, if cpufreq_add_dev_interface() fails, it calls kobject_put() for the policy kobject in its error code path and since that causes the kobject's refcount to become 0, the additional kobject_put() for the same kobject under err_out_unregister and the wait_for_completion() following it are pointless, so drop them. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c8b2ca0f44ae..924d3f5df26d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1109,9 +1109,6 @@ err_out_unregister:
1109 } 1109 }
1110 write_unlock_irqrestore(&cpufreq_driver_lock, flags); 1110 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
1111 1111
1112 kobject_put(&policy->kobj);
1113 wait_for_completion(&policy->kobj_unregister);
1114
1115err_set_policy_cpu: 1112err_set_policy_cpu:
1116 per_cpu(cpufreq_policy_cpu, cpu) = -1; 1113 per_cpu(cpufreq_policy_cpu, cpu) = -1;
1117 cpufreq_policy_free(policy); 1114 cpufreq_policy_free(policy);