kdb: Use str_plural() to fix Coccinelle warning
authorThorsten Blum <thorsten.blum@toblux.com>
Thu, 28 Mar 2024 14:00:17 +0000 (15:00 +0100)
committerDaniel Thompson <daniel.thompson@linaro.org>
Mon, 22 Apr 2024 15:53:19 +0000 (16:53 +0100)
Fixes the following Coccinelle/coccicheck warning reported by
string_choices.cocci:

opportunity for str_plural(days)

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20240328140015.388654-3-thorsten.blum@toblux.com
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
kernel/debug/kdb/kdb_main.c

index d05066cb40b2ee504d780b5f9ea5d16e17bcbbd1..664bae55f2c9d50d5dbf194cbd2189d468fdd023 100644 (file)
@@ -2517,7 +2517,7 @@ static int kdb_summary(int argc, const char **argv)
        if (val.uptime > (24*60*60)) {
                int days = val.uptime / (24*60*60);
                val.uptime %= (24*60*60);
-               kdb_printf("%d day%s ", days, days == 1 ? "" : "s");
+               kdb_printf("%d day%s ", days, str_plural(days));
        }
        kdb_printf("%02ld:%02ld\n", val.uptime/(60*60), (val.uptime/60)%60);