From: Andy Whitcroft <apw@shadowen.org>
Date: Thu, 16 Oct 2008 05:02:33 +0000 (-0700)
Subject: checkpatch: complex macros checks miss square brackets
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bf30d6ede099c2a31b13bbd05b1022dc0da684d5;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

checkpatch: complex macros checks miss square brackets

We are missing 'simple' values which include square brackets.  Refactor to
ensure we handle nesting correctly and detect these simple forms.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c479bdefc779..54dfa2b543dd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2142,9 +2142,10 @@ sub process {
 			$dstat =~ s/\s*$//s;
 
 			# Flatten any parentheses and braces
-			while ($dstat =~ s/\([^\(\)]*\)/1/) {
-			}
-			while ($dstat =~ s/\{[^\{\}]*\}/1/) {
+			while ($dstat =~ s/\([^\(\)]*\)/1/ ||
+			       $dstat =~ s/\{[^\{\}]*\}/1/ ||
+			       $dstat =~ s/\[[^\{\}]*\]/1/)
+			{
 			}
 
 			my $exceptions = qr{