]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()
authorColin Ian King <colin.king@canonical.com>
Tue, 5 Jan 2021 10:19:57 +0000 (10:19 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 7 Jan 2021 16:37:33 +0000 (17:37 +0100)
commit335253dde763b61fd99c9eeb6e19d82c0d86e1d8
tree6d186263321beadfc83d1ef041f08e74a6edb07c
parent7c61ff12077d6d57a3957d830de12faf50fa1d6e
cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get()

Currently there is an unlikely case where cpufreq_cpu_get() returns a
NULL policy and this will cause a NULL pointer dereference later on.

Fix this by passing the policy to transition_frequency_fidvid() from
the caller and hence eliminating the need for the cpufreq_cpu_get()
and cpufreq_cpu_put().

Thanks to Viresh Kumar for suggesting the fix.

Addresses-Coverity: ("Dereference null return")
Fixes: 30011aba5124 ("cpufreq: Notify all policy->cpus in cpufreq_notify_transition()")
Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/powernow-k8.c