[RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'

WangYuli posted 1 patch 2 months, 2 weeks ago
There is a newer version of this series
arch/riscv/kernel/cpu-hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'
Posted by WangYuli 2 months, 2 weeks ago
'cpu' is an unsigned integer, so its placeholder should be %u, not %d.

Suggested-by: Wentao Guan <guanwentao@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 arch/riscv/kernel/cpu-hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/cpu-hotplug.c b/arch/riscv/kernel/cpu-hotplug.c
index 28b58fc5ad19..a1e38ecfc8be 100644
--- a/arch/riscv/kernel/cpu-hotplug.c
+++ b/arch/riscv/kernel/cpu-hotplug.c
@@ -58,7 +58,7 @@ void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu)
 	if (cpu_ops->cpu_is_stopped)
 		ret = cpu_ops->cpu_is_stopped(cpu);
 	if (ret)
-		pr_warn("CPU%d may not have stopped: %d\n", cpu, ret);
+		pr_warn("CPU%u may not have stopped: %d\n", cpu, ret);
 }
 
 /*
-- 
2.43.4
Re: [RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'
Posted by Maciej W. Rozycki 2 months, 2 weeks ago
On Thu, 12 Sep 2024, WangYuli wrote:

> 'cpu' is an unsigned integer, so its placeholder should be %u, not %d.

 NB the proper ISO C and POSIX term for `%u', `%d', etc. is "conversion 
specifier" rather than "placeholder".

  Maciej
Re: [RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'
Posted by WangYuli 2 months, 2 weeks ago
On 2024/9/13 06:12, Maciej W. Rozycki wrote:

>   NB the proper ISO C and POSIX term for `%u', `%d', etc. is "conversion
> specifier" rather than "placeholder".

Thanks for pointing that out.

"conversion specifier" is much better and more professional.

>
>    Maciej
>
Thanks,
-- 
WangYuli
Re: [RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'
Posted by Charlie Jenkins 2 months, 2 weeks ago
On Thu, Sep 12, 2024 at 09:49:46PM +0800, WangYuli wrote:
> 'cpu' is an unsigned integer, so its placeholder should be %u, not %d.
> 
> Suggested-by: Wentao Guan <guanwentao@uniontech.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> ---
>  arch/riscv/kernel/cpu-hotplug.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/kernel/cpu-hotplug.c b/arch/riscv/kernel/cpu-hotplug.c
> index 28b58fc5ad19..a1e38ecfc8be 100644
> --- a/arch/riscv/kernel/cpu-hotplug.c
> +++ b/arch/riscv/kernel/cpu-hotplug.c
> @@ -58,7 +58,7 @@ void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu)
>  	if (cpu_ops->cpu_is_stopped)
>  		ret = cpu_ops->cpu_is_stopped(cpu);
>  	if (ret)
> -		pr_warn("CPU%d may not have stopped: %d\n", cpu, ret);
> +		pr_warn("CPU%u may not have stopped: %d\n", cpu, ret);
>  }
>  
>  /*
> -- 
> 2.43.4

Thanks!

Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Charlie Jenkins <charlie@rivosinc.com>

> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Re: [RESEND. PATCH] riscv: Use '%u' to format the output of 'cpu'
Posted by WangYuli 2 months, 2 weeks ago
On 2024/9/13 04:37, Charlie Jenkins wrote:
> Thanks!
>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
> Tested-by: Charlie Jenkins <charlie@rivosinc.com>
>
Thank Maciej W. Rozycki for his valuable input.

I have revised the commit msg (only) and resent a patch v2, with your 
Reviewed-by and Tested-by.

Link: 
https://lore.kernel.org/all/F5FDA7123183ED96+20240913030252.857482-1-wangyuli@uniontech.com/

Thanks,
-- 
WangYuli