]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lockdep: Use str_plural() to fix Coccinelle warning
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 28 May 2024 12:00:09 +0000 (14:00 +0200)
committerBoqun Feng <boqun.feng@gmail.com>
Tue, 6 Aug 2024 17:46:42 +0000 (10:46 -0700)
Fixes the following Coccinelle/coccicheck warning reported by
string_choices.cocci:

opportunity for str_plural(depth)

Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://lore.kernel.org/r/20240528120008.403511-2-thorsten.blum@toblux.com
kernel/locking/lockdep.c

index fee21f3c3b9972095587b315cc191ebab8d9653e..266f57f36f697d36da630842f877416a50d138da 100644 (file)
@@ -785,7 +785,7 @@ static void lockdep_print_held_locks(struct task_struct *p)
                printk("no locks held by %s/%d.\n", p->comm, task_pid_nr(p));
        else
                printk("%d lock%s held by %s/%d:\n", depth,
-                      depth > 1 ? "s" : "", p->comm, task_pid_nr(p));
+                      str_plural(depth), p->comm, task_pid_nr(p));
        /*
         * It's not reliable to print a task's held locks if it's not sleeping
         * and it's not the current task.