From: Joe Perches <joe@perches.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Dmitry Vyukov <dvyukov@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Will Deacon <will@kernel.org>
Subject: [PATCH] lockdep: Use different indentation in print_lock_class_header/print_lock_trace
Date: Tue, 19 May 2020 10:29:02 -0700 [thread overview]
Message-ID: <b10a31d999addb474530afaca7b2d4929a8da474.camel@perches.com> (raw)
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, "");
next reply other threads:[~2020-05-19 17:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 17:29 Joe Perches [this message]
2020-05-19 23:56 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b10a31d999addb474530afaca7b2d4929a8da474.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®