diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 27fbd880ef6397..c0688e6274182d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4419,11 +4419,13 @@ sub process { # 1. with a type on the left -- int [] a; # 2. at the beginning of a line for slice initialisers -- [0...10] = 5, # 3. inside a curly brace -- = { [0...10] = 5 } +# 4. inside macro arguments, example: #define HCI_ERR(err) [err] = #err while ($line =~ /(.*?\s)\[/g) { my ($where, $prefix) = ($-[1], $1); if ($prefix !~ /$Type\s+$/ && ($where != 0 || $prefix !~ /^.\s+$/) && $prefix !~ /[{,:]\s+$/ && + $prefix !~ /\#define\s+.+\s+$/ && $prefix !~ /:\s+$/) { if (ERROR("BRACKET_SPACE", "space prohibited before open square bracket '['\n" . $herecurr) &&