1
0
Fork 0

utils.commands: Fix CPU online detection when not present

Not all platforms can offline CPUs. On those that can't, there is no
"online" attribute. Default to online in that case.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2025-01-21 08:14:50 +09:00
parent 7480983aed
commit 13dc68447d

View file

@ -280,7 +280,7 @@ class commands:
def is_cpu_online(self, cpu):
scpu = str(cpu)
# CPU0 is always online
return cpu == "0" or self.read_file("/sys/devices/system/cpu/cpu%s/online" % scpu, no_error = True).strip() == "1"
return cpu == "0" or self.read_file("/sys/devices/system/cpu/cpu%s/online" % scpu, err_ret = "1", no_error = True).strip() == "1"
# Converts hexadecimal CPU mask to CPU list
def hex2cpulist(self, mask):