aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2017-09-08 19:16:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 21:26:50 -0400
commit0675a8fbd71c1a0b605ce82adea37131452f1070 (patch)
treef3df2c38e37d943dbebec8e670dc208e7efc7e70 /scripts
parentab1ecabf4fdbd80b9d4ab7eacfd318c517b3f8f4 (diff)
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl32
1 files changed, 16 insertions, 16 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3e66fbfd6234..b3a1bc70d9ee 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2715,10 +2715,10 @@ sub process {
2715 my $typo_fix = $spelling_fix{lc($typo)}; 2715 my $typo_fix = $spelling_fix{lc($typo)};
2716 $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/); 2716 $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
2717 $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/); 2717 $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
2718 my $msg_type = \&WARN; 2718 my $msg_level = \&WARN;
2719 $msg_type = \&CHK if ($file); 2719 $msg_level = \&CHK if ($file);
2720 if (&{$msg_type}("TYPO_SPELLING", 2720 if (&{$msg_level}("TYPO_SPELLING",
2721 "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) && 2721 "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
2722 $fix) { 2722 $fix) {
2723 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/; 2723 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
2724 } 2724 }
@@ -2753,10 +2753,10 @@ sub process {
2753 $rawline =~ /\b59\s+Temple\s+Pl/i || 2753 $rawline =~ /\b59\s+Temple\s+Pl/i ||
2754 $rawline =~ /\b51\s+Franklin\s+St/i) { 2754 $rawline =~ /\b51\s+Franklin\s+St/i) {
2755 my $herevet = "$here\n" . cat_vet($rawline) . "\n"; 2755 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
2756 my $msg_type = \&ERROR; 2756 my $msg_level = \&ERROR;
2757 $msg_type = \&CHK if ($file); 2757 $msg_level = \&CHK if ($file);
2758 &{$msg_type}("FSF_MAILING_ADDRESS", 2758 &{$msg_level}("FSF_MAILING_ADDRESS",
2759 "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) 2759 "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)
2760 } 2760 }
2761 2761
2762# check for Kconfig help text having a real description 2762# check for Kconfig help text having a real description
@@ -3810,10 +3810,10 @@ sub process {
3810 3810
3811# avoid BUG() or BUG_ON() 3811# avoid BUG() or BUG_ON()
3812 if ($line =~ /\b(?:BUG|BUG_ON)\b/) { 3812 if ($line =~ /\b(?:BUG|BUG_ON)\b/) {
3813 my $msg_type = \&WARN; 3813 my $msg_level = \&WARN;
3814 $msg_type = \&CHK if ($file); 3814 $msg_level = \&CHK if ($file);
3815 &{$msg_type}("AVOID_BUG", 3815 &{$msg_level}("AVOID_BUG",
3816 "Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()\n" . $herecurr); 3816 "Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()\n" . $herecurr);
3817 } 3817 }
3818 3818
3819# avoid LINUX_VERSION_CODE 3819# avoid LINUX_VERSION_CODE
@@ -4339,11 +4339,11 @@ sub process {
4339 4339
4340 # messages are ERROR, but ?: are CHK 4340 # messages are ERROR, but ?: are CHK
4341 if ($ok == 0) { 4341 if ($ok == 0) {
4342 my $msg_type = \&ERROR; 4342 my $msg_level = \&ERROR;
4343 $msg_type = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/); 4343 $msg_level = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/);
4344 4344
4345 if (&{$msg_type}("SPACING", 4345 if (&{$msg_level}("SPACING",
4346 "spaces required around that '$op' $at\n" . $hereptr)) { 4346 "spaces required around that '$op' $at\n" . $hereptr)) {
4347 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; 4347 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
4348 if (defined $fix_elements[$n + 2]) { 4348 if (defined $fix_elements[$n + 2]) {
4349 $fix_elements[$n + 2] =~ s/^\s+//; 4349 $fix_elements[$n + 2] =~ s/^\s+//;