* [PATCH] s390/smp: Use min() to fix Coccinelle warning
@ 2024-04-08 10:51 Thorsten Blum
2024-04-08 11:48 ` Heiko Carstens
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-04-08 10:51 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
Christian Borntraeger, Sven Schnelle
Cc: Frederic Weisbecker, Ilya Leoshkevich, linux-s390, linux-kernel,
Thorsten Blum
Fixes the following Coccinelle/coccicheck warning reported by
minmax.cocci:
WARNING opportunity for min()
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
arch/s390/kernel/smp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 0324649aae0a..d69cf2475744 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1205,7 +1205,7 @@ static int __init s390_smp_init(void)
rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "s390/smp:online",
smp_cpu_online, smp_cpu_pre_down);
- rc = rc <= 0 ? rc : 0;
+ rc = min(rc, 0);
out:
return rc;
}
--
2.44.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390/smp: Use min() to fix Coccinelle warning
2024-04-08 10:51 [PATCH] s390/smp: Use min() to fix Coccinelle warning Thorsten Blum
@ 2024-04-08 11:48 ` Heiko Carstens
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2024-04-08 11:48 UTC (permalink / raw)
To: Thorsten Blum
Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
Sven Schnelle, Frederic Weisbecker, Ilya Leoshkevich, linux-s390,
linux-kernel
On Mon, Apr 08, 2024 at 12:51:25PM +0200, Thorsten Blum wrote:
> Fixes the following Coccinelle/coccicheck warning reported by
> minmax.cocci:
>
> WARNING opportunity for min()
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
> arch/s390/kernel/smp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index 0324649aae0a..d69cf2475744 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1205,7 +1205,7 @@ static int __init s390_smp_init(void)
>
> rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "s390/smp:online",
> smp_cpu_online, smp_cpu_pre_down);
> - rc = rc <= 0 ? rc : 0;
> + rc = min(rc, 0);
No. This decreases readability. Please do not send such patches just
because Coccinelle reports something.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-08 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 10:51 [PATCH] s390/smp: Use min() to fix Coccinelle warning Thorsten Blum
2024-04-08 11:48 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox