"struct foo *bar" does not match the regex "$Declare\s+$Ident" $Declare matches "struct foo *" but there is no required space between the pointer "*" and the $Ident.
Also it ends in a pointer, the $Declare variable also contains all trailing spaces after the declaration so there is no space between $Declare and $Ident. ie: "struct foo * bar" does not match "$Declare\s+$Ident" So, change the \s+ to \s* to have this regex match any of "struct foo bar", "struct foo *bar", and "struct foo * bar" Signed-off-by: Joe Perches <j...@perches.com> --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 93beee8..bca2be0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2259,7 +2259,7 @@ sub process { # check for missing blank lines after declarations if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations - ($prevline =~ /^\+\s+$Declare\s+$Ident\s*[=,;\[]/ || + ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ || # foo bar; where foo is some local typedef or #define $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros @@ -2271,7 +2271,7 @@ sub process { # not starting a section or a macro "\" extended line $prevline =~ /(?:\{\s*|\\)$/) && # looks like a declaration - !($sline =~ /^\+\s+$Declare/ || + !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;\[]/ || # foo bar; where foo is some local typedef or #define $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros -- 1.8.1.2.459.gbcd45b4.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/