]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smp: Use str_plural() to fix Coccinelle warnings
authorThorsten Blum <thorsten.blum@toblux.com>
Wed, 8 May 2024 15:42:26 +0000 (17:42 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 17 Jun 2024 13:17:44 +0000 (15:17 +0200)
Fixes the following two Coccinelle/coccicheck warnings reported by
string_choices.cocci:

opportunity for str_plural(num_cpus)
opportunity for str_plural(num_nodes)

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20240508154225.309703-2-thorsten.blum@toblux.com
kernel/smp.c

index f085ebcdf9e709ac3303aa87a0ebc34c42f3aaac..18483570cc5f45aa507b06ffd3771dc8404f00c8 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/nmi.h>
 #include <linux/sched/debug.h>
 #include <linux/jump_label.h>
+#include <linux/string_choices.h>
 
 #include <trace/events/ipi.h>
 #define CREATE_TRACE_POINTS
@@ -982,8 +983,7 @@ void __init smp_init(void)
        num_nodes = num_online_nodes();
        num_cpus  = num_online_cpus();
        pr_info("Brought up %d node%s, %d CPU%s\n",
-               num_nodes, (num_nodes > 1 ? "s" : ""),
-               num_cpus,  (num_cpus  > 1 ? "s" : ""));
+               num_nodes, str_plural(num_nodes), num_cpus, str_plural(num_cpus));
 
        /* Any cleanup work */
        smp_cpus_done(setup_max_cpus);