Browse Source

checkpatch: fix 'return is not a function' square bracket handling

We are incorrectly matching square brackets '[' and ']' leading to false
positives on more complex functions as below:

    return (dt3155_fbuffer[m]->ready_head -
	dt3155_fbuffer[m]->ready_len +
	dt3155_fbuffer[m]->nbuffers)%
	(dt3155_fbuffer[m]->nbuffers);

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Andy Whitcroft 13 years ago
parent
commit
e01886ada2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      scripts/checkpatch.pl

+ 1 - 1
scripts/checkpatch.pl

@@ -2609,7 +2609,7 @@ sub process {
 			# Flatten any parentheses
 			# Flatten any parentheses
 			$value =~ s/\(/ \(/g;
 			$value =~ s/\(/ \(/g;
 			$value =~ s/\)/\) /g;
 			$value =~ s/\)/\) /g;
-			while ($value =~ s/\[[^\{\}]*\]/1/ ||
+			while ($value =~ s/\[[^\[\]]*\]/1/ ||
 			       $value !~ /(?:$Ident|-?$Constant)\s*
 			       $value !~ /(?:$Ident|-?$Constant)\s*
 					     $Compare\s*
 					     $Compare\s*
 					     (?:$Ident|-?$Constant)/x &&
 					     (?:$Ident|-?$Constant)/x &&