aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5e63dce2e428..6d85c7b1b27e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4522,6 +4522,20 @@ sub process {
4522 "Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr); 4522 "Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr);
4523 } 4523 }
4524 4524
4525# check for pointer comparisons to NULL
4526 if ($^V && $^V ge 5.10.0) {
4527 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
4528 my $val = $1;
4529 my $equal = "!";
4530 $equal = "" if ($4 eq "!=");
4531 if (CHK("COMPARISON_TO_NULL",
4532 "Comparison to NULL could be written \"${equal}${val}\"\n" . $herecurr) &&
4533 $fix) {
4534 $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
4535 }
4536 }
4537 }
4538
4525# check for bad placement of section $InitAttribute (e.g.: __initdata) 4539# check for bad placement of section $InitAttribute (e.g.: __initdata)
4526 if ($line =~ /(\b$InitAttribute\b)/) { 4540 if ($line =~ /(\b$InitAttribute\b)/) {
4527 my $attr = $1; 4541 my $attr = $1;