summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKaushlendra Kumar2025-12-01 17:47:45 +0530
committerSasha Levin2026-03-04 07:20:32 -0500
commit7823e09a68b5492336815b2de566ced8431d3eb3 (patch)
tree8afe4472298f0d4331351434de88c8255770415b /tools
parent93e8e3ee165ae4609a1222b516b573837103d2c3 (diff)
tools/power cpupower: Reset errno before strtoull()
[ Upstream commit f9bd3762cf1bd0c2465f2e6121b340883471d1bf ] 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>
Diffstat (limited to 'tools')
-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 c15d0de12357..e7b8c5663837 100644
--- a/tools/power/cpupower/lib/cpuidle.c
+++ b/tools/power/cpupower/lib/cpuidle.c
@@ -148,6 +148,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)