]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: intel_pstate: Avoid division by 0 in min_perf_pct_min()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Jun 2017 12:51:18 +0000 (14:51 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Jun 2017 12:51:18 +0000 (14:51 +0200)
commitfcc225853e48a3d09828972ad15e2b2e5a6c937d
tree19d5662b5b54fe439eeb62520f021ff71eabf30d
parent3827627dd32a34356a3364f08e236d95face4382
cpufreq: intel_pstate: Avoid division by 0 in min_perf_pct_min()

Commit e5c06b80e7a7 (cpufreq: intel_pstate: Active mode P-state
limits rework) incorrectly assumed that pstate.turbo_pstate would
always be nonzero for CPU0 in min_perf_pct_min() if
cpufreq_register_driver() had succeeded which may not be the case
in virtualized environments.

If that assumption doesn't hold, it leads to an early crash on boot
in intel_pstate_register_driver(), so add a sanity check to
min_perf_pct_min() to prevent the crash from happening.

Fixes: e5c06b80e7a7 (cpufreq: intel_pstate: Active mode P-state limits rework)
Reported-and-tested-by: Jongman Heo <jongman.heo@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c