aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudeep Holla <[email protected]>2022-07-04 11:15:59 +0100
committerSudeep Holla <[email protected]>2022-07-04 16:22:29 +0100
commit5a01bb8efb5177236498fc57b147cabd2b792613 (patch)
tree8e01976a48c0cf9df290e06f6a0539baec3417d8
parent9eb5e54f876dda1aae0aef10bdd61da4331509ba (diff)
arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found
There is no point in looping through all the CPU's physical package identifier to check if it is valid or not once a CPU which is outside the topology(i.e. outlier CPU) is found. Let us just break out of the loop early in such case. Link: https://lore.kernel.org/r/[email protected] Tested-by: Ionela Voinescu <[email protected]> Tested-by: Conor Dooley <[email protected]> Reviewed-by: Gavin Shan <[email protected]> Signed-off-by: Sudeep Holla <[email protected]>
-rw-r--r--drivers/base/arch_topology.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index c0b0ee64a79d..8f6a964d2512 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -642,8 +642,10 @@ 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 < 0)
+ if (cpu_topology[cpu].package_id < 0) {
ret = -EINVAL;
+ break;
+ }
out_map:
of_node_put(map);