summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>2025-12-01 15:17:45 +0300
committerShuah Khan <skhan@linuxfoundation.org>2025-12-15 22:33:28 +0300
commitf9bd3762cf1bd0c2465f2e6121b340883471d1bf (patch)
tree9a4e92dbada29aa7763fd6d29f3966537807e58a
parent1b9aaf36b7b40235e5a529c15848c3d866362207 (diff)
downloadlinux-f9bd3762cf1bd0c2465f2e6121b340883471d1bf.tar.xz
tools/power cpupower: Reset errno before strtoull()
cpuidle_state_get_one_value() never cleared errno before calling strtoull(), so a prior ERANGE caused every cpuidle counter read to return zero. Reset errno to 0 before the conversion so each sysfs read is evaluated independently. Link: https://lore.kernel.org/r/20251201121745.3776703-1-kaushlendra.kumar@intel.com Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-rw-r--r--tools/power/cpupower/lib/cpuidle.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/power/cpupower/lib/cpuidle.c b/tools/power/cpupower/lib/cpuidle.c
index 6a881d93d2e9..2fcb343d8e75 100644
--- a/tools/power/cpupower/lib/cpuidle.c
+++ b/tools/power/cpupower/lib/cpuidle.c
@@ -150,6 +150,7 @@ unsigned long long cpuidle_state_get_one_value(unsigned int cpu,
if (len == 0)
return 0;
+ errno = 0;
value = strtoull(linebuf, &endp, 0);
if (endp == linebuf || errno == ERANGE)