summaryrefslogtreecommitdiff
path: root/tools/power/x86
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2020-03-06 01:45:12 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-03-20 15:46:19 +0300
commitf0e0b4d17baaaf4968664f8fe79c66a7417aaab0 (patch)
treef47bb96e700436a150fbdc40f8121d9965d3df89 /tools/power/x86
parentced2f5304d1409805edd661b5f32092f3878be05 (diff)
downloadlinux-f0e0b4d17baaaf4968664f8fe79c66a7417aaab0.tar.xz
tools/power/x86/intel-speed-select: Warn for invalid package id
When CPU is offline, we can't get package id. So print error for this and don't use output. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'tools/power/x86')
-rw-r--r--tools/power/x86/intel-speed-select/isst-config.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-config.c b/tools/power/x86/intel-speed-select/isst-config.c
index c922cfd7ba50..3f019f4f90df 100644
--- a/tools/power/x86/intel-speed-select/isst-config.c
+++ b/tools/power/x86/intel-speed-select/isst-config.c
@@ -261,6 +261,10 @@ static void for_each_online_package_in_set(void (*callback)(int, void *, void *,
if (die_id < 0)
die_id = 0;
pkg_id = get_physical_package_id(i);
+ if (pkg_id < 0) {
+ fprintf(stderr, "Failed to get package id, CPU %d may be offline\n", i);
+ continue;
+ }
/* Create an unique id for package, die combination to store */
pkg_id = (MAX_PACKAGE_COUNT * pkg_id + die_id);
@@ -362,6 +366,10 @@ static void set_cpu_present_cpu_mask(void)
die_id = 0;
pkg_id = get_physical_package_id(i);
+ if (pkg_id < 0) {
+ fprintf(stderr, "Failed to get package id, CPU %d may be offline\n", i);
+ continue;
+ }
if (pkg_id < MAX_PACKAGE_COUNT &&
die_id < MAX_DIE_PER_PACKAGE) {
int core_id = get_physical_core_id(i);