From: Andy Whitcroft Date: Thu, 15 Jan 2009 21:51:06 +0000 (-0800) Subject: checkpatch: allow parentheses on return handle array values X-Git-Tag: MMI-PSA29.97-13-9~29816 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63f17f8973ccdb8260e59ce5b1b4e2b2ee0401f0;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git checkpatch: allow parentheses on return handle array values When we allow return to have surrounding parentheses when containing comparison operators we are not correctly handling the case where the values contain array sufffixes. Squash them. Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1d7924ad3a34..696196e194f5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2016,7 +2016,11 @@ sub process { # Flatten any parentheses $value =~ s/\)\(/\) \(/g; - while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) { + while ($value =~ s/\[[^\{\}]*\]/1/ || + $value !~ /(?:$Ident|-?$Constant)\s* + $Compare\s* + (?:$Ident|-?$Constant)/x && + $value =~ s/\([^\(\)]*\)/1/) { } if ($value =~ /^(?:$Ident|-?$Constant)$/) {