]> git.ipfire.org Git - oddments/collecty.git/commitdiff
sources: cpufreq: Disable source if there is no support
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2025 17:54:57 +0000 (17:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 26 Oct 2025 17:54:57 +0000 (17:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/sources/cpufreq.c

index d315bc195036ef3882444a504258d641d5b399ce..94cd99db4e1780971ef152cbe8d2c99d35fed399 100644 (file)
@@ -86,8 +86,17 @@ static int cpufreq_heartbeat(td_ctx* ctx, td_source* source) {
        // Collect metrics for each available processor
        for (long i = 0; i < num; i++) {
                r = cpufreq_heartbeat_cpu(ctx, source, i);
-               if (r < 0)
-                       return r;
+               if (r < 0) {
+                       switch (-r) {
+                               // We probably don't have cpufreq support
+                               case ENOENT:
+                                       return td_source_disable(source);
+
+                               // Abort on any other errors
+                               default:
+                                       return r;
+                       }
+               }
        }
 
        return 0;