]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
checkpatch: improve the SUSPECT_CODE_INDENT test
authorJoe Perches <joe@perches.com>
Mon, 8 May 2017 22:56:05 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 May 2017 00:15:11 +0000 (17:15 -0700)
commitf6950a735f29e782bc219ece22bb91d6e1ab7bbc
treeaeb8aacfa0c31e53997c33ee0939ff996fcfd4f7
parent74fd4f347bfc10c1b19a18d0760f220eed1b2023
checkpatch: improve the SUSPECT_CODE_INDENT test

The current SUSPECT_CODE_INDENT test does not recognize several
defective code style defects where code following a logical test is
inappropriately indented.

Before this patch, for code like:

if (foo)
bar();

checkpatch would not emit a warning.

Improve the test to warn when code after a logical test has the same
indentation as the logical test.

Perform the same indentation test for "else" blocks too.

Link: http://lkml.kernel.org/r/df2374b68c4a68af2b7ef08afe486584811f610a.1493683942.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl