diff mbox series

[v3,1/3] powerpc/numa: Simplify find_primary_domain_index

Message ID 20260902123458.340456-6-srikar@linux.ibm.com (mailing list archive)
State New
Headers show
Series powerpc/numa: Enable coregroup support on PowerNV | expand

Commit Message

Srikar Dronamraju Sept. 2, 2026, 12:35 p.m. UTC
Initialize the return value once and use a single exit path in
find_primary_domain_index().

This is a small cleanup that keeps the existing behavior unchanged while
making the control flow easier to follow.

Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
---
Changelog from v1:
- Handle comments from Christophe Leroy

 arch/powerpc/mm/numa.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Shrikanth Hegde Sept. 4, 2026, 10:05 a.m. UTC | #1
On 9/2/26 6:05 PM, Srikar Dronamraju wrote:
> Initialize the return value once and use a single exit path in
> find_primary_domain_index().
> 
> This is a small cleanup that keeps the existing behavior unchanged while
> making the control flow easier to follow.
> 

Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>

> Signed-off-by: Srikar Dronamraju <srikar@linux.ibm.com>
> ---
> Changelog from v1:
> - Handle comments from Christophe Leroy
> 
>   arch/powerpc/mm/numa.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index f4cf3ae036de..c44a80d8fc11 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -432,7 +432,7 @@ static void __init initialize_form2_numa_distance_lookup_table(void)
>   
>   static int __init find_primary_domain_index(void)
>   {
> -	int index;
> +	int index = -1;
>   	struct device_node *root;
>   
>   	/*
> @@ -502,12 +502,9 @@ static int __init find_primary_domain_index(void)
>   		distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
>   	}
>   
> -	of_node_put(root);
> -	return index;
> -
>   err:
>   	of_node_put(root);
> -	return -1;
> +	return index;
>   }
>   
>   static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
diff mbox series

Patch

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f4cf3ae036de..c44a80d8fc11 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -432,7 +432,7 @@  static void __init initialize_form2_numa_distance_lookup_table(void)
 
 static int __init find_primary_domain_index(void)
 {
-	int index;
+	int index = -1;
 	struct device_node *root;
 
 	/*
@@ -502,12 +502,9 @@  static int __init find_primary_domain_index(void)
 		distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
 	}
 
-	of_node_put(root);
-	return index;
-
 err:
 	of_node_put(root);
-	return -1;
+	return index;
 }
 
 static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)