From: Andy Whitcroft Date: Fri, 16 Dec 2011 04:50:19 +0000 (+1100) Subject: checkpatch: fix 'return is not a function' square bracket handling X-Git-Tag: next-20111221~2^2~96 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5369a1f4b2939e00fca9bd191773bb386f52dd3b;p=karo-tx-linux.git 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 Cc: Joe Perches Signed-off-by: Andrew Morton --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ca6d0fb229f2..5e3f4191f959 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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 &&