From: Andy Whitcroft Date: Tue, 10 Jan 2012 23:10:08 +0000 (-0800) Subject: checkpatch: fix 'return is not a function' square bracket handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e01886ada28741d7cb2cfb3224e9caccfbc1a2d5;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ca6d0fb229f..5e3f4191f95 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 &&