]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
tools/power/x86/intel-speed-select: Show error for invalid CPUs in the options
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 5 Mar 2020 22:45:32 +0000 (14:45 -0800)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 20 Mar 2020 12:46:22 +0000 (14:46 +0200)
When --cpu or -c is used to specify target CPUs and non of them are valid,
display error.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c

index 7a8a315ac8d1c35676fa2e3bf7245f2dd76a2680..386791aaeca14efa0122945b74edd5aa9c8c8487 100644 (file)
@@ -425,7 +425,7 @@ static void for_each_online_target_cpu_in_set(
        void (*callback)(int, void *, void *, void *, void *), void *arg1,
        void *arg2, void *arg3, void *arg4)
 {
-       int i;
+       int i, found = 0;
 
        for (i = 0; i < topo_max_cpus; ++i) {
                int online;
@@ -439,9 +439,14 @@ static void for_each_online_target_cpu_in_set(
                        online =
                                1; /* online entry for CPU 0 needs some special configs */
 
-               if (online && callback)
+               if (online && callback) {
                        callback(i, arg1, arg2, arg3, arg4);
+                       found = 1;
+               }
        }
+
+       if (!found)
+               fprintf(stderr, "No valid CPU in the list\n");
 }
 
 #define BITMASK_SIZE 32