diff options
author | Joe Perches <joe@perches.com> | 2014-10-13 15:52:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-14 02:18:15 +0200 |
commit | f78d98f6ce66fc7cc0be714d56b0240923a8b4f4 (patch) | |
tree | 36223291ffb6e126634841301453262c616a0ca7 /scripts | |
parent | 840080a08492bd2bb3314077b672b59c88bbe0e6 (diff) | |
download | op-kernel-dev-f78d98f6ce66fc7cc0be714d56b0240923a8b4f4.zip op-kernel-dev-f78d98f6ce66fc7cc0be714d56b0240923a8b4f4.tar.gz |
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-x | scripts/checkpatch.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 52a223e..374abf4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4447,6 +4447,17 @@ sub process { } } +# check for logging functions with KERN_<LEVEL> + if ($line !~ /printk\s*\(/ && + $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) { + my $level = $1; + if (WARN("UNNECESSARY_KERN_LEVEL", + "Possible unnecessary $level\n" . $herecurr) && + $fix) { + $fixed[$fixlinenr] =~ s/\s*$level\s*//; + } + } + # check for bad placement of section $InitAttribute (e.g.: __initdata) if ($line =~ /(\b$InitAttribute\b)/) { my $attr = $1; |