mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lockdep: Use str_plural() to fix Coccinelle warning
@ 2024-03-28 10:09 Thorsten Blum
  2024-03-28 12:41 ` Waiman Long
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2024-03-28 10:09 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon
  Cc: Waiman Long, Boqun Feng, linux-kernel, Thorsten Blum

Fixes the following Coccinelle/coccicheck warning reported by
string_choices.cocci:

	opportunity for str_plural(depth)

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 kernel/locking/lockdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 151bd3de5936..31d7720c9b8d 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -786,7 +786,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.
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lockdep: Use str_plural() to fix Coccinelle warning
  2024-03-28 10:09 [PATCH] lockdep: Use str_plural() to fix Coccinelle warning Thorsten Blum
@ 2024-03-28 12:41 ` Waiman Long
  2024-04-21 23:17   ` [RESEND PATCH] " Thorsten Blum
  0 siblings, 1 reply; 3+ messages in thread
From: Waiman Long @ 2024-03-28 12:41 UTC (permalink / raw)
  To: Thorsten Blum, Peter Zijlstra, Ingo Molnar, Will Deacon
  Cc: Boqun Feng, linux-kernel

On 3/28/24 06:09, Thorsten Blum wrote:
> Fixes the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> 	opportunity for str_plural(depth)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>   kernel/locking/lockdep.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 151bd3de5936..31d7720c9b8d 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -786,7 +786,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.
Acked-by: Waiman Long <longman@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [RESEND PATCH] lockdep: Use str_plural() to fix Coccinelle warning
  2024-03-28 12:41 ` Waiman Long
@ 2024-04-21 23:17   ` Thorsten Blum
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2024-04-21 23:17 UTC (permalink / raw)
  To: longman; +Cc: boqun.feng, linux-kernel, mingo, peterz, thorsten.blum, will

Fixes the following Coccinelle/coccicheck warning reported by
string_choices.cocci:

	opportunity for str_plural(depth)

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Acked-by: Waiman Long <longman@redhat.com>
---
 kernel/locking/lockdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 151bd3de5936..31d7720c9b8d 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -786,7 +786,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.
-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-21 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 10:09 [PATCH] lockdep: Use str_plural() to fix Coccinelle warning Thorsten Blum
2024-03-28 12:41 ` Waiman Long
2024-04-21 23:17   ` [RESEND PATCH] " Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®