aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2016-05-20 20:04:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-20 20:58:30 -0400
commitf39e1769bbfc4936ff8364fb2529dc8bf6bc6888 (patch)
treea3ed1a88fa0d29022c876037258ecb5827a2fea2
parent2d6327459ec5e63a89b12945f483f6d7378a8839 (diff)
checkpatch: improve CONSTANT_COMPARISON test for structure members
A "." dereference to an all uppercase structure member can be incorrectly reported as a CONSTANT_COMPARISON. ie: "if (table[i].PANELID == tempdx)" Fix it by checking for "." before the constant test. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-xscripts/checkpatch.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index eb8f88787e81..e3d9c34b1b53 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4291,7 +4291,7 @@ sub process {
4291 my $comp = $3; 4291 my $comp = $3;
4292 my $to = $4; 4292 my $to = $4;
4293 my $newcomp = $comp; 4293 my $newcomp = $comp;
4294 if ($lead !~ /$Operators\s*$/ && 4294 if ($lead !~ /(?:$Operators|\.)\s*$/ &&
4295 $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ && 4295 $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&
4296 WARN("CONSTANT_COMPARISON", 4296 WARN("CONSTANT_COMPARISON",
4297 "Comparisons should place the constant on the right side of the test\n" . $herecurr) && 4297 "Comparisons should place the constant on the right side of the test\n" . $herecurr) &&