Skip to content

Commit 185d566

Browse files
robherringtorvalds
authored andcommitted
checkpatch: fix wildcard DT compatible string checking
We attempt to search for compatible strings which use a variable token in the documented name such as <chip> or <soc>. While this was attempted to be handled, it's utterly broken. The desired forms of matching are: vendor,<chip>-* vendor,name<part#>-* For <chip>, lower case characters and numbers are permitted. For <part#>, only numeric values are allowed. With this change, the number of missing compatible strings reported in arch/arm/boot/dts is reduced from 1071 to 960. Reported-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Rob Herring <robh@kernel.org> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Florian Vaussard <florian.vaussard@epfl.ch> Cc: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6516a46 commit 185d566

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,8 +2093,10 @@ sub process {
20932093

20942094
foreach my $compat (@compats) {
20952095
my $compat2 = $compat;
2096-
$compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/;
2097-
`grep -Erq "$compat|$compat2" $dt_path`;
2096+
$compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
2097+
my $compat3 = $compat;
2098+
$compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
2099+
`grep -Erq "$compat|$compat2|$compat3" $dt_path`;
20982100
if ( $? >> 8 ) {
20992101
WARN("UNDOCUMENTED_DT_STRING",
21002102
"DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);

0 commit comments

Comments
 (0)