cpufreq: Initialize policy->kobj while allocating policy
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 8 Jun 2015 12:55:29 +0000 (18:25 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 10 Jun 2015 23:01:54 +0000 (01:01 +0200)
commit2fc3384dc75bf7333384c7a16d12c796f61c3f56
treef5c7146445748ccf9dbd004d518301d7fcc6e326
parent87549141d516aee71d511138e27117c41e8aef68
cpufreq: Initialize policy->kobj while allocating policy

policy->kobj is required to be initialized once in the lifetime of a
policy.  Currently we are initializing it from __cpufreq_add_dev() and
that doesn't look to be the best place for doing so as we have to do
this on special cases (like: !recover_policy).

We can initialize it from a more obvious place cpufreq_policy_alloc()
and that will make code look cleaner, specially the error handling part.

The error handling part of __cpufreq_add_dev() was doing almost the same
thing while recover_policy is true or false. Fix that as well by always
calling cpufreq_policy_put_kobj() with an additional parameter to skip
notification part of it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c