mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-04 08:33:27 +01:00
checkpatch: warn on unnecessary void function return statements
void function lines that use a single tab then "return;" are generally unnecessary. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
afc819ab02
commit
9819cf252a
1 file changed
+7
@@ -3470,6 +3470,13 @@ sub process {
|
||||
}
|
||||
}
|
||||
|
||||
# unnecessary return in a void function? (a single leading tab, then return;)
|
||||
if ($sline =~ /^\+\treturn\s*;\s*$/ &&
|
||||
$prevline =~ /^\+/) {
|
||||
WARN("RETURN_VOID",
|
||||
"void function return statements are not generally useful\n" . $herecurr);
|
||||
}
|
||||
|
||||
# if statements using unnecessary parentheses - ie: if ((foo == bar))
|
||||
if ($^V && $^V ge 5.10.0 &&
|
||||
$line =~ /\bif\s*((?:\(\s*){2,})/) {
|
||||
|
||||
Reference in new issue
Block a user