Improve the vendor name match in vendor-prefix.txt by only matching the exact vendor name at the beginning of lines.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -2080,9 +2080,11 @@ sub process { · 2079 unmodified lines | ||
| 2080 | 2080 | |
| 2081 | 2081 | my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g; |
| 2082 | 2082 | |
| 2083 | + my $dt_path = $root . "/Documentation/devicetree/bindings/"; | |
| 2084 | + my $vp_file = $dt_path . "vendor-prefixes.txt"; | |
| 2085 | + | |
| 2083 | 2086 | foreach my $compat (@compats) { |
| 2084 | 2087 | my $compat2 = $compat; |
| 2085 | − my $dt_path = $root . "/Documentation/devicetree/bindings/"; | |
| 2086 | 2088 | $compat2 =~ s/\,[a-z]*\-/\,<\.\*>\-/; |
| 2087 | 2089 | `grep -Erq "$compat|$compat2" $dt_path`; |
| 2088 | 2090 | if ( $? >> 8 ) { |
| @@ -2090,14 +2092,12 @@ sub process { · 1 unmodified line | ||
| 2090 | 2092 | "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr); |
| 2091 | 2093 | } |
| 2092 | 2094 | |
| 2093 | − my $vendor_path = $dt_path . "vendor-prefixes.txt"; | |
| 2094 | − next if (! -f $vendor_path); | |
| 2095 | 2095 | next if $compat !~ /^([a-zA-Z0-9\-]+)\,/; |
| 2096 | 2096 | my $vendor = $1; |
| 2097 | − `grep -Eq "$vendor" $vendor_path`; | |
| 2097 | + `grep -Eq "^$vendor\\b" $vp_file`; | |
| 2098 | 2098 | if ( $? >> 8 ) { |
| 2099 | 2099 | WARN("UNDOCUMENTED_DT_STRING", |
| 2100 | − "DT compatible string vendor \"$vendor\" appears un-documented -- check $vendor_path\n" . $herecurr); | |
| 2100 | + "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr); | |
| 2101 | 2101 | } |
| 2102 | 2102 | } |
| 2103 | 2103 | } |