mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace
@ 2020-05-19 17:29 Joe Perches
  2020-05-19 23:56 ` kbuild test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2020-05-19 17:29 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Dmitry Vyukov, LKML, Andrew Morton, Will Deacon

This code that uses the printk return value in
kernel/locking/lockdep.c is odd because the printk
return value includes both the length of a KERN_<LEVEL>
prefix and a newline.  depth is also double counted.

Change the code to calculate depth + 3 + strlen.

Signed-off-by: Joe Perches <joe@perches.com>
---
 kernel/locking/lockdep.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 2fadc2635946..265227edc550 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1960,11 +1960,9 @@ static void print_lock_class_header(struct lock_class *class, int depth)
 
 	for (bit = 0; bit < LOCK_USAGE_STATES; bit++) {
 		if (class->usage_mask & (1 << bit)) {
-			int len = depth;
-
-			len += printk("%*s   %s", depth, "", usage_str[bit]);
-			len += printk(KERN_CONT " at:\n");
-			print_lock_trace(class->usage_traces[bit], len);
+			printk("%*s   %s at:\n", depth, "", usage_str[bit]);
+			print_lock_trace(class->usage_traces[bit],
+					 depth + 3 + strlen(usage_str[bit]);
 		}
 	}
 	printk("%*s }\n", depth, "");




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

end of thread, other threads:[~2020-05-19 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 17:29 [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace Joe Perches
2020-05-19 23:56 ` kbuild test robot

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®