diff options
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 8dce8a8d9ed0..2a8c6c3c1bdb 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -3829,28 +3829,10 @@ sub process { | |||
3829 | "Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr); | 3829 | "Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr); |
3830 | } | 3830 | } |
3831 | 3831 | ||
3832 | # printk should use KERN_* levels. Note that follow on printk's on the | 3832 | # printk should use KERN_* levels |
3833 | # same line do not need a level, so we use the current block context | 3833 | if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) { |
3834 | # to try and find and validate the current printk. In summary the current | 3834 | WARN("PRINTK_WITHOUT_KERN_LEVEL", |
3835 | # printk includes all preceding printk's which have no newline on the end. | 3835 | "printk() should include KERN_<LEVEL> facility level\n" . $herecurr); |
3836 | # we assume the first bad printk is the one to report. | ||
3837 | if ($line =~ /\bprintk\((?!KERN_)\s*"/) { | ||
3838 | my $ok = 0; | ||
3839 | for (my $ln = $linenr - 1; $ln >= $first_line; $ln--) { | ||
3840 | #print "CHECK<$lines[$ln - 1]\n"; | ||
3841 | # we have a preceding printk if it ends | ||
3842 | # with "\n" ignore it, else it is to blame | ||
3843 | if ($lines[$ln - 1] =~ m{\bprintk\(}) { | ||
3844 | if ($rawlines[$ln - 1] !~ m{\\n"}) { | ||
3845 | $ok = 1; | ||
3846 | } | ||
3847 | last; | ||
3848 | } | ||
3849 | } | ||
3850 | if ($ok == 0) { | ||
3851 | WARN("PRINTK_WITHOUT_KERN_LEVEL", | ||
3852 | "printk() should include KERN_ facility level\n" . $herecurr); | ||
3853 | } | ||
3854 | } | 3836 | } |
3855 | 3837 | ||
3856 | if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) { | 3838 | if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) { |