Commit e98f033f authored by Jacob Tanenbaum's avatar Jacob Tanenbaum Committed by Rafael J. Wysocki

cpupower: fix how "cpupower frequency-info" interprets latency

the intel-pstate driver does not support the ondemand governor and does not
have a valid value in
/sys/devices/system/cpu/cpu[x]/cpufreq/cpuinfo_transition_latency. The
intel-pstate driver sets cpuinfo_transition_latency to CPUFREQ_ETERNAL (-1),
the value written into cpuinfo_transition_latency is defind as an unsigned
int so checking the read value against max unsigned int will determine if the
value is valid.
Signed-off-by: default avatarJacob Tanenbaum <jtanenba@redhat.com>
Signed-off-by: default avatarThomas Renninger <trenn@suse.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 562e5f1a
......@@ -434,8 +434,8 @@ static int get_latency(unsigned int cpu, unsigned int human)
unsigned long latency = cpufreq_get_transition_latency(cpu);
printf(_(" maximum transition latency: "));
if (!latency) {
printf(_(" Cannot determine latency.\n"));
if (!latency || latency == UINT_MAX) {
printf(_(" Cannot determine or is not supported.\n"));
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment