[PATCH] powerpc/64: Drop unnecessary 'rc' variable

Xichao Zhao posted 1 patch 2 months ago
arch/powerpc/kernel/setup_64.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH] powerpc/64: Drop unnecessary 'rc' variable
Posted by Xichao Zhao 2 months ago
Simplify the code to enhance readability and maintain a consistent 
coding style.


Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 arch/powerpc/kernel/setup_64.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 7284c8021eeb..8fd7cbf3bd04 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -141,10 +141,7 @@ void __init check_smt_enabled(void)
 			smt_enabled_at_boot = 0;
 		else {
 			int smt;
-			int rc;
-
-			rc = kstrtoint(smt_enabled_cmdline, 10, &smt);
-			if (!rc)
+			if (!kstrtoint(smt_enabled_cmdline, 10, &smt))
 				smt_enabled_at_boot =
 					min(threads_per_core, smt);
 		}
-- 
2.34.1
Re: [PATCH] powerpc/64: Drop unnecessary 'rc' variable
Posted by Gautam Menghani 2 months ago
On Fri, Aug 01, 2025 at 11:59:08AM +0800, Xichao Zhao wrote:
> Simplify the code to enhance readability and maintain a consistent 
> coding style.
> 
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  arch/powerpc/kernel/setup_64.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 7284c8021eeb..8fd7cbf3bd04 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -141,10 +141,7 @@ void __init check_smt_enabled(void)
>  			smt_enabled_at_boot = 0;
>  		else {
>  			int smt;
> -			int rc;
> -
> -			rc = kstrtoint(smt_enabled_cmdline, 10, &smt);
> -			if (!rc)
> +			if (!kstrtoint(smt_enabled_cmdline, 10, &smt))
>  				smt_enabled_at_boot =
>  					min(threads_per_core, smt);
>  		}


Thanks for the cleanup

Acked-by: Gautam Menghani <gautam@linux.ibm.com>

Thanks,
Gautam
Re: [PATCH] powerpc/64: Drop unnecessary 'rc' variable
Posted by Madhavan Srinivasan 1 month, 1 week ago
On Fri, 01 Aug 2025 11:59:08 +0800, Xichao Zhao wrote:
> Simplify the code to enhance readability and maintain a consistent
> coding style.
> 
> 

Applied to powerpc/fixes.

[1/1] powerpc/64: Drop unnecessary 'rc' variable
      https://git.kernel.org/powerpc/c/8b5d86a63bc9510e094a15d7268c60bd4347b95c

Thanks