Skip to content
/ linux Public

Commit 7823e09

Browse files
kaushlenSasha Levin
authored andcommitted
tools/power cpupower: Reset errno before strtoull()
[ Upstream commit f9bd376 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 93e8e3e commit 7823e09

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/power/cpupower/lib/cpuidle.c

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

151+
errno = 0;
151152
value = strtoull(linebuf, &endp, 0);
152153

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

0 commit comments

Comments
 (0)