diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2022-07-04 11:15:58 +0100 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2022-07-04 16:22:29 +0100 |
commit | 9eb5e54f876dda1aae0aef10bdd61da4331509ba (patch) | |
tree | 56ae2ad394ffabdee80fa6a2d11171c43c6b481f /drivers/base | |
parent | 3f8283296b16c4e43fd79a5ac364ae8171fe1567 (diff) | |
download | linux-9eb5e54f876dda1aae0aef10bdd61da4331509ba.tar.gz linux-9eb5e54f876dda1aae0aef10bdd61da4331509ba.tar.bz2 linux-9eb5e54f876dda1aae0aef10bdd61da4331509ba.zip |
arch_topology: Check for non-negative value rather than -1 for IDs validity
Instead of just comparing the cpu topology IDs with -1 to check their
validity, improve that by checking for a valid non-negative value.
Link: https://lore.kernel.org/r/20220704101605.1318280-15-sudeep.holla@arm.com
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Ionela Voinescu <ionela.voinescu@arm.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/arch_topology.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 6ab173caf1dc..c0b0ee64a79d 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -642,7 +642,7 @@ static int __init parse_dt_topology(void) * only mark cores described in the DT as possible. */ for_each_possible_cpu(cpu) - if (cpu_topology[cpu].package_id == -1) + if (cpu_topology[cpu].package_id < 0) ret = -EINVAL; out_map: @@ -714,7 +714,7 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->cluster_id != cpu_topo->cluster_id) continue; - if (cpuid_topo->cluster_id != -1) { + if (cpuid_topo->cluster_id >= 0) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } |