cpufreq: Fix broken usage of governor->owner's refcount
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 6 Aug 2013 17:23:10 +0000 (22:53 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 10 Aug 2013 01:24:47 +0000 (03:24 +0200)
commitfe492f3f0332e23cc6ca4913e5a2ed78e1888902
tree0e87539040aabaf02babc0edc49fbb27610b0e3b
parenteb608521f1e25a8c14295b6d9a3853c3cd8c6cf8
cpufreq: Fix broken usage of governor->owner's refcount

The cpufreq governor owner refcount usage is broken.  We should only
increment that refcount when a CPUFREQ_GOV_POLICY_INIT event has come
and it should only be decremented if CPUFREQ_GOV_POLICY_EXIT has come.

Currently, there can be situations where the governor is in use, but
we have allowed it to be unloaded which may result in undefined
behavior.  Let's fix 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