[PATCH v4 2/6] arch_topology: drop the use of cpu_node in the pr_info

Alireza Sanaee alireza.sanaee at huawei.com
Tue Nov 11 07:00:33 PST 2025


On Fri, 5 Sep 2025 17:18:25 +0100
Alireza Sanaee <alireza.sanaee at huawei.com> wrote:

Hi everyone,

+CC Sudeep.

I checked the patchset related to this patch and it still applies.

Just a reminder if case you think it is ready.

Thanks,
Alireza

> 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.
> 
> Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>
> Signed-off-by: Alireza Sanaee <alireza.sanaee at 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;
>  }
>  




More information about the linux-arm-kernel mailing list