aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-10-13 18:52:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:18:15 -0400
commitf78d98f6ce66fc7cc0be714d56b0240923a8b4f4 (patch)
tree36223291ffb6e126634841301453262c616a0ca7 /scripts
parent840080a08492bd2bb3314077b672b59c88bbe0e6 (diff)
checkpatch: warn on logging functions with KERN_<LEVEL>
Warn on probable misuses of logging functions with KERN_<LEVEL> like pr_err(KERN_ERR "foo\n"); Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 52a223ebcd10..374abf443636 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4447,6 +4447,17 @@ sub process {
4447 } 4447 }
4448 } 4448 }
4449 4449
4450# check for logging functions with KERN_<LEVEL>
4451 if ($line !~ /printk\s*\(/ &&
4452 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
4453 my $level = $1;
4454 if (WARN("UNNECESSARY_KERN_LEVEL",
4455 "Possible unnecessary $level\n" . $herecurr) &&
4456 $fix) {
4457 $fixed[$fixlinenr] =~ s/\s*$level\s*//;
4458 }
4459 }
4460
4450# check for bad placement of section $InitAttribute (e.g.: __initdata) 4461# check for bad placement of section $InitAttribute (e.g.: __initdata)
4451 if ($line =~ /(\b$InitAttribute\b)/) { 4462 if ($line =~ /(\b$InitAttribute\b)/) {
4452 my $attr = $1; 4463 my $attr = $1;