History

checkpatch: printks always need a KERN_<LEVEL>

There was code in checkpatch that allowed continuation printks to be used without KERN_CONT. Remove the continuation check and always require a KERN_<LEVEL>.

Joe Perches committed 8 years ago

Commit eeef5731 parent 258f79d1 file · +4 −22Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+4−22
@@ -3829,28 +3829,10 @@ sub process { · 3828 unmodified lines
38293829 "Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr);
38303830 }
38313831
3832−# printk should use KERN_* levels. Note that follow on printk's on the
3833−# same line do not need a level, so we use the current block context
3834−# to try and find and validate the current printk. In summary the current
3835−# printk includes all preceding printk's which have no newline on the end.
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− }
3832+# printk should use KERN_* levels
3833+ if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
3834+ WARN("PRINTK_WITHOUT_KERN_LEVEL",
3835+ "printk() should include KERN_<LEVEL> facility level\n" . $herecurr);
38543836 }
38553837
38563838 if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) {