util/lint/checkpatch.pl: Remove unneeded whitespaces and fix some typos

This is to reduce difference with linux v5.16.

Change-Id: I4aa7abce83b41ccd5129717cd3bf85be19ec4807
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61467
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Elyes HAOUAS
2022-01-29 07:48:52 +01:00
committed by Martin Roth
parent 48cb78b6d9
commit 919b0c7d4d

View File

@@ -3870,7 +3870,7 @@ sub process {
WARN("STATIC_CONST_CHAR_ARRAY", WARN("STATIC_CONST_CHAR_ARRAY",
"static char array declaration should probably be static const char\n" . "static char array declaration should probably be static const char\n" .
$herecurr); $herecurr);
} }
# check for const <foo> const where <foo> is not a pointer or array type # check for const <foo> const where <foo> is not a pointer or array type
if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) { if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) {
@@ -3889,7 +3889,7 @@ sub process {
WARN("STATIC_CONST_CHAR_ARRAY", WARN("STATIC_CONST_CHAR_ARRAY",
"char * array declaration might be better as static const\n" . "char * array declaration might be better as static const\n" .
$herecurr); $herecurr);
} }
# check for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo) # check for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo)
if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) { if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
@@ -4483,7 +4483,7 @@ sub process {
($op eq '>' && ($op eq '>' &&
$ca =~ /<\S+\@\S+$/)) $ca =~ /<\S+\@\S+$/))
{ {
$ok = 1; $ok = 1;
} }
# for asm volatile statements # for asm volatile statements
@@ -4549,7 +4549,7 @@ sub process {
## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) { ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
## ##
## # Remove any bracketed sections to ensure we do not ## # Remove any bracketed sections to ensure we do not
## # falsly report the parameters of functions. ## # falsely report the parameters of functions.
## my $ln = $line; ## my $ln = $line;
## while ($ln =~ s/\([^\(\)]*\)//g) { ## while ($ln =~ s/\([^\(\)]*\)//g) {
## } ## }
@@ -4718,7 +4718,7 @@ sub process {
$lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) { $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
WARN("RETURN_VOID", WARN("RETURN_VOID",
"void function return statements are not generally useful\n" . $hereprev); "void function return statements are not generally useful\n" . $hereprev);
} }
# if statements using unnecessary parentheses - ie: if ((foo == bar)) # if statements using unnecessary parentheses - ie: if ((foo == bar))
if ($perl_version_ok && if ($perl_version_ok &&
@@ -4819,7 +4819,7 @@ sub process {
# conditional. # conditional.
substr($s, 0, length($c), ''); substr($s, 0, length($c), '');
$s =~ s/\n.*//g; $s =~ s/\n.*//g;
$s =~ s/$;//g; # Remove any comments $s =~ s/$;//g; # Remove any comments
if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ && if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
$c !~ /}\s*while\s*/) $c !~ /}\s*while\s*/)
{ {
@@ -4858,7 +4858,7 @@ sub process {
# if and else should not have general statements after it # if and else should not have general statements after it
if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) { if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
my $s = $1; my $s = $1;
$s =~ s/$;//g; # Remove any comments $s =~ s/$;//g; # Remove any comments
if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) { if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
ERROR("TRAILING_STATEMENTS", ERROR("TRAILING_STATEMENTS",
"trailing statements should be on next line\n" . $herecurr); "trailing statements should be on next line\n" . $herecurr);
@@ -5043,7 +5043,7 @@ sub process {
{ {
} }
# Flatten any obvious string concatentation. # Flatten any obvious string concatenation.
while ($dstat =~ s/($String)\s*$Ident/$1/ || while ($dstat =~ s/($String)\s*$Ident/$1/ ||
$dstat =~ s/$Ident\s*($String)/$1/) $dstat =~ s/$Ident\s*($String)/$1/)
{ {
@@ -6545,7 +6545,7 @@ sub process {
exit(0); exit(0);
} }
# This is not a patch, and we are are in 'no-patch' mode so # This is not a patch, and we are in 'no-patch' mode so
# just keep quiet. # just keep quiet.
if (!$chk_patch && !$is_patch) { if (!$chk_patch && !$is_patch) {
exit(0); exit(0);