cpufreq: check cpufreq driver is valid and cpufreq isn't disabled in cpufreq_get()
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 20 Sep 2013 17:07:31 +0000 (22:37 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 25 Sep 2013 01:24:02 +0000 (03:24 +0200)
cpufreq_get() can be called from external drivers which might not be aware if
cpufreq driver is registered or not. And so we should actually check if cpufreq
driver is registered or not and also if cpufreq is active or disabled, at the
beginning of cpufreq_get().

Otherwise call to lock_policy_rwsem_read() might hit BUG_ON(!policy).

Reported-and-tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

No differences found