Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5129e87c authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

checkpatch: fix "GLOBAL_INITIALISERS" test



Commit d5e616fc ("checkpatch: add a few more --fix corrections")
broke the GLOBAL_INITIALISERS test with bad parentheses and optional
leading spaces.

Fix it.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Reported-by: default avatarBandan Das <bsd@makefile.in>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d7ad41a1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3169,12 +3169,12 @@ sub process {
		}

# check for global initialisers.
		if ($line =~ /^\+(\s*$Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/) {
		if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) {
			if (ERROR("GLOBAL_INITIALISERS",
				  "do not initialise globals to 0 or NULL\n" .
				      $herecurr) &&
			    $fix) {
				$fixed[$fixlinenr] =~ s/($Type\s*$Ident\s*(?:\s+$Modifier))*\s*=\s*(0|NULL|false)\s*;/$1;/;
				$fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/;
			}
		}
# check for static initialisers.