The patch titled Subject: checkpatch: check for space after "else" keyword has been added to the -mm tree. Its filename is checkpatch-check-for-space-after-else-keyword.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-check-for-space-after-else-keyword.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-check-for-space-after-else-keyword.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Michal Zylowski <michal.zylowski@xxxxxxxxx> Subject: checkpatch: check for space after "else" keyword Current checkpatch implementation permits notation like } else{ in kernel code. It looks like oversight and inconsistency in checkpatch rules (e.g. instruction like 'do' is tested). Add regex for checking space after 'else' keyword and trigger error if space is not present. Link: http://lkml.kernel.org/r/1533545753-8870-1-git-send-email-michal.zylowski@xxxxxxxxx Signed-off-by: Michal Zylowski <michal.zylowski@xxxxxxxxx> Acked-by: Joe Perches <joe@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN scripts/checkpatch.pl~checkpatch-check-for-space-after-else-keyword scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-check-for-space-after-else-keyword +++ a/scripts/checkpatch.pl @@ -4531,11 +4531,11 @@ sub process { #need space before brace following if, while, etc if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || - $line =~ /do\{/) { + $line =~ /\b(?:else|do)\{/) { if (ERROR("SPACING", "space required before the open brace '{'\n" . $herecurr) && $fix) { - $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\)))\{/$1 {/; + $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/; } } _ Patches currently in -mm which might be from michal.zylowski@xxxxxxxxx are checkpatch-check-for-space-after-else-keyword.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html