Skip to content

Commit 2acb9bd

Browse files
committed
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 <[email protected]> Acked-by: Viresh Kumar <[email protected]>
1 parent df24014 commit 2acb9bd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,11 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
11341134
cpufreq_global_kobject, "policy%u", cpu);
11351135
if (ret) {
11361136
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+
*/
11371142
kobject_put(&policy->kobj);
11381143
goto err_free_real_cpus;
11391144
}

0 commit comments

Comments
 (0)