checkpatch: add new message type string
Many messsages are missing the new message type parameter, which
causes warning messages and a lack of the line number from the
offending line in the patch.
Change-Id: I69f2283c3dc27edd66fd2676c8be45664699dba6
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 77a6dd9..deb67f5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1634,7 +1634,8 @@
$exec_file =~ /^Kconfig$/) &&
$rawline =~ /^new (file )?mode\s([0-9]+)$/ &&
(oct($2) & 0111)) {
- ERROR("Source file has +x permissions: " .
+ ERROR("EXECUTE_PERMISSIONS",
+ "Source file has +x permissions: " .
"$exec_file\n");
}
$here .= "FILE: $realfile:$realline:" if ($realcnt != 0);
@@ -1647,7 +1648,8 @@
if ($shorttext == IN_SHORTTEXT_BLANKLINE && $line=~/\S/) {
# the subject line was just processed,
# a blank line must be next
- WARN("non-blank line after summary line\n" . $herecurr);
+ WARN("NONBLANK_AFTER_SUMMARY",
+ "non-blank line after summary line\n" . $herecurr);
$shorttext = IN_SHORTTEXT;
# this non-blank line may or may not be commit text -
# a warning has been generated so assume it is commit
@@ -1658,7 +1660,8 @@
if ($shorttext == IN_SHORTTEXT) {
if ($line=~/^---/ || $line=~/^diff.*/) {
if ($commit_text_present == 0) {
- WARN("please add commit text explaining " .
+ WARN("NO_COMMIT_TEXT",
+ "please add commit text explaining " .
"*why* the change is needed\n" .
$herecurr);
}
@@ -1668,7 +1671,8 @@
&& $line !~ /^:([0-7]{6}\s){2}
([[:xdigit:]]+\.*
\s){2}\w+\s\w+/xms) {
- WARN("commit text line over " .
+ WARN("LONG_COMMIT_TEXT",
+ "commit text line over " .
SHORTTEXT_LIMIT .
" characters\n" . $herecurr);
} elsif ($line=~/^\s*change-id:/i ||
@@ -1678,7 +1682,8 @@
# this is a tag, there must be commit
# text by now
if ($commit_text_present == 0) {
- WARN("please add commit text explaining " .
+ WARN("NO_COMMIT_TEXT",
+ "please add commit text explaining " .
"*why* the change is needed\n" .
$herecurr);
# prevent duplicate warnings
@@ -1699,7 +1704,8 @@
$shorttext = IN_SHORTTEXT;
# Check for Subject line followed by a blank line.
if (length($line) != 0) {
- WARN("non-blank line after " .
+ WARN("NONBLANK_AFTER_SUMMARY",
+ "non-blank line after " .
"summary line\n" .
$sublinenr . $here .
"\n" . $subjectline .
@@ -1721,7 +1727,8 @@
$sublinenr = "#$linenr & ";
# Check for Subject line less than line limit
if (length($1) > SHORTTEXT_LIMIT) {
- WARN("summary line over " .
+ WARN("LONG_SUMMARY_LINE",
+ "summary line over " .
SHORTTEXT_LIMIT .
" characters\n" . $herecurr);
}
@@ -1732,7 +1739,8 @@
$shorttext = IN_SHORTTEXT_BLANKLINE;
$shorttext_exspc = 4;
if (length($1) > SHORTTEXT_LIMIT) {
- WARN("summary line over " .
+ WARN("LONG_SUMMARY_LINE",
+ "summary line over " .
SHORTTEXT_LIMIT .
" characters\n" . $herecurr);
}
@@ -1797,13 +1805,14 @@
}
}
if ($line =~ /^\s*signed-off-by:.*(quicinc|qualcomm)\.com/i) {
- WARN("invalid Signed-off-by identity\n" . $line );
+ WARN("BAD_SIGN_OFF",
+ "invalid Signed-off-by identity\n" . $line );
}
}
#check the patch for invalid author credentials
if ($line =~ /^From:.*(quicinc|qualcomm)\.com/) {
- WARN("invalid author identity\n" . $line );
+ WARN("BAD_AUTHOR", "invalid author identity\n" . $line );
}
# Check for wrappage within a valid hunk of the file
@@ -3291,19 +3300,20 @@
# sys_open/read/write/close are not allowed in the kernel
if ($line =~ /\b(sys_(?:open|read|write|close))\b/) {
- ERROR("$1 is inappropriate in kernel code.\n" .
+ ERROR("FILE_OPS", "$1 is inappropriate in kernel code.\n" .
$herecurr);
}
# filp_open is a backdoor for sys_open
if ($line =~ /\b(filp_open)\b/) {
- ERROR("$1 is inappropriate in kernel code.\n" .
+ ERROR("FILE_OPS", "$1 is inappropriate in kernel code.\n" .
$herecurr);
}
# read[bwl] & write[bwl] use too many barriers, use the _relaxed variants
if ($line =~ /\b((?:read|write)[bwl])\b/) {
- ERROR("Use of $1 is deprecated: use $1_relaxed\n\t" .
+ ERROR("NON_RELAXED_IO",
+ "Use of $1 is deprecated: use $1_relaxed\n\t" .
"with appropriate memory barriers instead.\n" .
$herecurr);
}
@@ -3313,7 +3323,8 @@
my ($all, $pref, $suf) = ($1, $2, $3);
$pref =~ s/in/read/;
$pref =~ s/out/write/;
- ERROR("Use of $all is deprecated: use " .
+ ERROR("NON_RELAXED_IO",
+ "Use of $all is deprecated: use " .
"__raw_$pref$suf\n\t" .
"with appropriate memory barriers instead.\n" .
$herecurr);
@@ -3321,7 +3332,8 @@
# dsb is too ARMish, and should usually be mb.
if ($line =~ /\bdsb\b/) {
- WARN("Use of dsb is discouranged: prefer mb.\n" .
+ WARN("ARM_BARRIER",
+ "Use of dsb is discouranged: prefer mb.\n" .
$herecurr);
}
@@ -3329,12 +3341,13 @@
if ($realfile =~ /\/mach-msm\/board-[0-9]+/ &&
$realfile !~ /camera/ && $realfile !~ /gpiomux/ &&
$line =~ /\s*struct msm_gpiomux_config\s*/ ) {
- WARN("Non gpiomux board file cannot have a gpiomux config declarations. Please declare gpiomux configs in board-*-gpiomux.c file.\n" . $herecurr);
+ WARN("GPIOMUX_IN_BOARD",
+ "Non gpiomux board file cannot have a gpiomux config declarations. Please declare gpiomux configs in board-*-gpiomux.c file.\n" . $herecurr);
}
# MSM - check if vreg_xxx function are used
if ($line =~ /\b(vreg_(get|put|set_level|enable|disable))\b/) {
- WARN("Use of $1 API is deprecated: " .
+ WARN("DEPRECATED_VREG_APIS", "Use of $1 API is deprecated: " .
"use regulator APIs\n" . $herecurr);
}
@@ -3354,7 +3367,8 @@
);
foreach my $k (keys %str_fns) {
if ($line =~ /\b$k\b/) {
- ERROR("Use of $k is deprecated: " .
+ ERROR("UNBOUNDED_STRING_FNS",
+ "Use of $k is deprecated: " .
"use $str_fns{$k} instead.\n" .
$herecurr);
}
@@ -3362,13 +3376,15 @@
# warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
- WARN("if this code is redundant consider removing it\n"
+ WARN("IF_0",
+ "if this code is redundant consider removing it\n"
. $herecurr);
}
# warn about #if 1
if ($line =~ /^.\s*\#\s*if\s+1\b/) {
- WARN("if this code is required consider removing"
+ WARN("IF_1",
+ "if this code is required consider removing"
. " #if 1\n" . $herecurr);
}
@@ -3408,7 +3424,8 @@
# check the patch for use of mdelay
if ($line =~ /\bmdelay\s*\(/) {
- WARN("use of mdelay() found: msleep() is the preferred API.\n" . $line );
+ WARN("MDELAY",
+ "use of mdelay() found: msleep() is the preferred API.\n" . $line );
}
# warn about #ifdefs in C files
@@ -3598,7 +3615,8 @@
# check for return codes on error paths
if ($line =~ /\breturn\s+-\d+/) {
- ERROR("illegal return value, please use an error code\n" . $herecurr);
+ ERROR("NO_ERROR_CODE",
+ "illegal return value, please use an error code\n" . $herecurr);
}
# check for gcc specific __FUNCTION__