]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
checkpatch: fix 'return is not a function' square bracket handling
authorAndy Whitcroft <apw@canonical.com>
Fri, 2 Dec 2011 03:12:45 +0000 (14:12 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 5 Dec 2011 04:19:29 +0000 (15:19 +1100)
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>
scripts/checkpatch.pl

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