Remove the use of cpu_node in the pr_info. When of_cpu_node_to_id fails, it may set a pointer, cpu_node, and the get_cpu_for_node function uses that pointer to log further in the fail scenario.
Also, change the structure to exit early in fail scenarios which will help enabling code unification that follows in this series.
Signed-off-by: Alireza Sanaee alireza.sanaee@huawei.com --- drivers/base/arch_topology.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 1037169abb45..6fafd86f608a 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -481,12 +481,13 @@ static int __init get_cpu_for_node(struct device_node *node) return -1;
cpu = of_cpu_node_to_id(cpu_node); - if (cpu >= 0) - topology_parse_cpu_capacity(cpu_node, cpu); - else - pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n", - cpu_node, cpumask_pr_args(cpu_possible_mask)); + if (cpu < 0) { + pr_info("CPU node exist but the possible cpu range is :%*pbl\n", + cpumask_pr_args(cpu_possible_mask)); + return cpu; + }
+ topology_parse_cpu_capacity(cpu_node, cpu); return cpu; }