cpufreq: Ref the policy object sooner
Do it before it's assigned to cpufreq_cpu_data, otherwise when a driver
tries to get the cpu frequency during initialization the policy kobj is
referenced and we get this warning:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 64 at include/linux/kref.h:47 kobject_get+0x64/0x70()
Modules linked in:
CPU: 1 PID: 64 Comm: irq/77-tegra-ac Not tainted
3.18.0-rc4-next-20141114ccu-00050-g3eff942 #326
[<
c0016fac>] (unwind_backtrace) from [<
c001272c>] (show_stack+0x10/0x14)
[<
c001272c>] (show_stack) from [<
c06085d8>] (dump_stack+0x98/0xd8)
[<
c06085d8>] (dump_stack) from [<
c002892c>] (warn_slowpath_common+0x84/0xb4)
[<
c002892c>] (warn_slowpath_common) from [<
c00289f8>] (warn_slowpath_null+0x1c/0x24)
[<
c00289f8>] (warn_slowpath_null) from [<
c0220290>] (kobject_get+0x64/0x70)
[<
c0220290>] (kobject_get) from [<
c03e944c>] (cpufreq_cpu_get+0x88/0xc8)
[<
c03e944c>] (cpufreq_cpu_get) from [<
c03e9500>] (cpufreq_get+0xc/0x64)
[<
c03e9500>] (cpufreq_get) from [<
c0285288>] (actmon_thread_isr+0x134/0x198)
[<
c0285288>] (actmon_thread_isr) from [<
c0069008>] (irq_thread_fn+0x1c/0x40)
[<
c0069008>] (irq_thread_fn) from [<
c0069324>] (irq_thread+0x134/0x174)
[<
c0069324>] (irq_thread) from [<
c0040290>] (kthread+0xdc/0xf4)
[<
c0040290>] (kthread) from [<
c000f4b8>] (ret_from_fork+0x14/0x3c)
---[ end trace
b7bd64a81b340c59 ]---
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>