Commit 9eb5e54f authored by Sudeep Holla's avatar Sudeep Holla

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.comSuggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: default avatarIonela Voinescu <ionela.voinescu@arm.com>
Tested-by: default avatarConor Dooley <conor.dooley@microchip.com>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 3f828329
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment