[patch] checkpatch: complain about GW-BASIC style label names

From: Dan Carpenter
Date: Thu May 07 2015 - 07:21:30 EST


GW-BASIC style label names are quite common. This generates a warning
like:

WARNING: bad label name
#795: FILE: drivers/ata/pata_mpc52xx.c:795:
+ err2:

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..ee3fa30 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4023,6 +4023,16 @@ sub process {
}
}

+#avoid GW-BASIC style label names
+ if ($line=~/^\+\s*(err|error|fail|out)[0-9]+:/) {
+ if (WARN("LABEL_NAME",
+ "bad label name\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~
+ s/^(.)\s+/$1/;
+ }
+ }
+
# return is not a function
if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
my $spacing = $1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/