checkpatch: rename variables to avoid confusion

The variable name "$msg_type" is sometimes used to set the message type,
and sometimes used to set the message level.  This works but is kind of
confusing.  Use "$msg_level" in the latter case instead, to make the code
clearer.

Link: http://lkml.kernel.org/r/20170902175345.175db33a@endymion
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jean Delvare
2017-09-08 16:16:07 -07:00
committed by Linus Torvalds
parent ab1ecabf4f
commit 0675a8fbd7

View File

@@ -2715,9 +2715,9 @@ sub process {
my $typo_fix = $spelling_fix{lc($typo)}; my $typo_fix = $spelling_fix{lc($typo)};
$typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
$typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/); $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
my $msg_type = \&WARN; my $msg_level = \&WARN;
$msg_type = \&CHK if ($file); $msg_level = \&CHK if ($file);
if (&{$msg_type}("TYPO_SPELLING", if (&{$msg_level}("TYPO_SPELLING",
"'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) && "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
$fix) { $fix) {
$fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/; $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
@@ -2753,9 +2753,9 @@ sub process {
$rawline =~ /\b59\s+Temple\s+Pl/i || $rawline =~ /\b59\s+Temple\s+Pl/i ||
$rawline =~ /\b51\s+Franklin\s+St/i) { $rawline =~ /\b51\s+Franklin\s+St/i) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n"; my $herevet = "$here\n" . cat_vet($rawline) . "\n";
my $msg_type = \&ERROR; my $msg_level = \&ERROR;
$msg_type = \&CHK if ($file); $msg_level = \&CHK if ($file);
&{$msg_type}("FSF_MAILING_ADDRESS", &{$msg_level}("FSF_MAILING_ADDRESS",
"Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet) "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
} }
@@ -3810,9 +3810,9 @@ sub process {
# avoid BUG() or BUG_ON() # avoid BUG() or BUG_ON()
if ($line =~ /\b(?:BUG|BUG_ON)\b/) { if ($line =~ /\b(?:BUG|BUG_ON)\b/) {
my $msg_type = \&WARN; my $msg_level = \&WARN;
$msg_type = \&CHK if ($file); $msg_level = \&CHK if ($file);
&{$msg_type}("AVOID_BUG", &{$msg_level}("AVOID_BUG",
"Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()\n" . $herecurr); "Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()\n" . $herecurr);
} }
@@ -4339,10 +4339,10 @@ sub process {
# messages are ERROR, but ?: are CHK # messages are ERROR, but ?: are CHK
if ($ok == 0) { if ($ok == 0) {
my $msg_type = \&ERROR; my $msg_level = \&ERROR;
$msg_type = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/); $msg_level = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/);
if (&{$msg_type}("SPACING", if (&{$msg_level}("SPACING",
"spaces required around that '$op' $at\n" . $hereptr)) { "spaces required around that '$op' $at\n" . $hereptr)) {
$good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
if (defined $fix_elements[$n + 2]) { if (defined $fix_elements[$n + 2]) {