diff options
author | Joe Perches <joe@perches.com> | 2015-06-10 14:14:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-10 19:43:43 -0400 |
commit | 5129e87cb81996d4d7e8f5a86b5355c5f2d0383b (patch) | |
tree | 27031787fd91dc2194c9186ef2f4e414841f91b7 | |
parent | d7ad41a1c498729b7584c257710b1b437a0c1470 (diff) |
checkpatch: fix "GLOBAL_INITIALISERS" test
Commit d5e616fc1c1d ("checkpatch: add a few more --fix corrections")
broke the GLOBAL_INITIALISERS test with bad parentheses and optional
leading spaces.
Fix it.
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Bandan Das <bsd@makefile.in>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-x | scripts/checkpatch.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 89b1df4e72ab..c5ec977b9c37 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -3169,12 +3169,12 @@ sub process { | |||
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | # check for global initialisers. | 3171 | # check for global initialisers. |
3172 | if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) { | 3172 | if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) { |
3173 | if (ERROR("GLOBAL_INITIALISERS", | 3173 | if (ERROR("GLOBAL_INITIALISERS", |
3174 | "do not initialise globals to 0 or NULL\n" . | 3174 | "do not initialise globals to 0 or NULL\n" . |
3175 | $herecurr) && | 3175 | $herecurr) && |
3176 | $fix) { | 3176 | $fix) { |
3177 | $fixed[$fixlinenr] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/; | 3177 | $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/; |
3178 | } | 3178 | } |
3179 | } | 3179 | } |
3180 | # check for static initialisers. | 3180 | # check for static initialisers. |