Skip to content

Commit f9bd376

Browse files
kaushlenshuahkh
authored andcommitted
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>
1 parent 1b9aaf3 commit f9bd376

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tools/power/cpupower/lib/cpuidle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ unsigned long long cpuidle_state_get_one_value(unsigned int cpu,
150150
if (len == 0)
151151
return 0;
152152

153+
errno = 0;
153154
value = strtoull(linebuf, &endp, 0);
154155

155156
if (endp == linebuf || errno == ERANGE)

0 commit comments

Comments
 (0)