]> git.baikalelectronics.ru Git - kernel.git/commit
checkpatch: add exception to return then else test
authorJoe Perches <joe@perches.com>
Mon, 13 Oct 2014 22:51:59 +0000 (15:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:18:15 +0000 (02:18 +0200)
commitc4f808bc28a9650e19f642cb4e1686ba4b487938
tree7af7c1f6fbe2218941ec74d9d1eccebe681d10d8
parente2e9a985a4d09756e5de0d0d976d3b982e5949da
checkpatch: add exception to return then else test

Add an exception to the return before else warning when the line
following it is also a return like:

if (foo)
return bar;
else
return baz;

This form of a test then return is at least as readable as

if (foo)
return bar;
return baz;

so don't emit a warning on the first form.

Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Elshad Mustafayev <elshadimo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl