summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 862cc7a740e2..f354ae619da0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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,})/) {