Skip to content

Commit 45c55e9

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: warn on logging continuations
pr_cont(...) and printk(KERN_CONT ...) uses should be discouraged as their output can be interleaved by multiple logging processes. Link: http://lkml.kernel.org/r/7100ba00098694ec81471a299583ed068975fd05.1483465888.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 77cb854 commit 45c55e9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/checkpatch.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5287,6 +5287,12 @@ sub process {
52875287
}
52885288
}
52895289

5290+
# check for logging continuations
5291+
if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
5292+
WARN("LOGGING_CONTINUATION",
5293+
"Avoid logging continuation uses where feasible\n" . $herecurr);
5294+
}
5295+
52905296
# check for mask then right shift without a parentheses
52915297
if ($^V && $^V ge 5.10.0 &&
52925298
$line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&

0 commit comments

Comments
 (0)