tools/power cpupower: Reset errno before strtoull()
PATCH 1/1 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.
Signed-off-by Kaushlendra Kumar <[email protected]>
--- tools/power/cpupower/lib/cpuidle.c | 1 + 1 file changed, 1 insertion(+)
tools/power/cpupower/lib/cpuidle.c +1 -0
@@ -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 )
Signature · 1 line
2.34.1