aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-05-10 06:35:53 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-05-13 04:43:53 -0400
commit2acb9bdae92d0662cd4fa11c481e80b6202b5630 (patch)
treec7ab1416d6435c0caeb5cd664d68998c5b2444c8
parentdf24014abe3694e7c34ce5e50248611b7a93fe83 (diff)
cpufreq: Explain the kobject_put() in cpufreq_policy_alloc()
It may not be particularly clear why the kobject_put() after failing kobject_init_and_add() in cpufreq_policy_alloc() is not redundant, so add a comment to explain that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r--drivers/cpufreq/cpufreq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index c66eefe928c5..57a3853a55fb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1134,6 +1134,11 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
1134 cpufreq_global_kobject, "policy%u", cpu); 1134 cpufreq_global_kobject, "policy%u", cpu);
1135 if (ret) { 1135 if (ret) {
1136 pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); 1136 pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret);
1137 /*
1138 * The entire policy object will be freed below, but the extra
1139 * memory allocated for the kobject name needs to be freed by
1140 * releasing the kobject.
1141 */
1137 kobject_put(&policy->kobj); 1142 kobject_put(&policy->kobj);
1138 goto err_free_real_cpus; 1143 goto err_free_real_cpus;
1139 } 1144 }