]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/cpupower: Fix inverted APERF capability check
authorKaushlendra Kumar <kaushlendra.kumar@intel.com>
Wed, 26 Nov 2025 09:16:13 +0000 (14:46 +0530)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 15 Dec 2025 19:33:28 +0000 (12:33 -0700)
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.

Link: https://lore.kernel.org/r/20251126091613.567480-1-kaushlendra.kumar@intel.com
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/power/cpupower/utils/cpufreq-info.c

index 7d3732f5f2f6f5fd5cc90e32465a94b4c10a654e..5fe01e516817e8b8a3dfd6eb6d3a095c909dffea 100644 (file)
@@ -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);