History

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");

Joe Perches committed 12 years ago

Commit f78d98f1 parent 840080a1 file · +11 −0Browse files

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

Unified · Split

scripts/checkpatch.pl+11−0
@@ -4447,6 +4447,17 @@ sub process { · 4446 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t