Skip to contentSkip to conversation

tools/cpupower: Fix inverted APERF capability check

PATCH New Kaushlendra Kumar 1 participant 1 message Nov 26, 2025 CPU power monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/cpupower: Fix inverted APERF capability check

The capability check was inverted, causing the function to return error when APERF support is available and proceed when it is not.

Negate the condition to return error only when APERF capability is absent.

---
 tools/power/cpupower/utils/cpufreq-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/utils/cpufreq-info.c +1 -1
index 7d3732f5f2f6..5fe01e516817 100644
@@ -270,7 +270,7 @@ static int get_freq_hardware(unsigned int cpu, unsigned int human)
 {
 	unsigned long freq;
 
-	if (cpupower_cpu_info.caps & CPUPOWER_CAP_APERF)
+	if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_APERF))
 		return -EINVAL;
 
 	freq = cpufreq_get_freq_hardware(cpu);
Signature · 1 line
2.34.1