Lines Matching +full:sub +full:- +full:spaces
2 # SPDX-License-Identifier: GPL-2.0
7 # (c) 2008-2010 Andy Whitcroft <[email protected]>
8 # (c) 2010-2018 Joe Perches <[email protected]>
69 my $docsfile = "$D/../Documentation/dev-tools/checkpatch.rst";
72 my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
74 my $git_command ='export LANGUAGE=en_US.UTF-8; git';
80 sub help {
88 -q, --quiet quiet
89 -v, --verbose verbose mode
90 --no-tree run without a kernel tree
91 --no-signoff do not check for 'Signed-off-by' line
92 --no-fixes-tag do not check for 'Fixes:' tag
93 --patch treat FILE as patchfile (default)
94 --emacs emacs compile window format
95 --terse one line per report
96 --showfile emit diffed file position, not input file position
97 -g, --git treat FILE as a single commit or git revision range
105 <rev>-<count>
107 -f, --file treat FILE as regular source file
108 --subjective, --strict enable more subjective tests
109 --list-types list the possible message types
110 --types TYPE(,TYPE2...) show only these comma separated message types
111 --ignore TYPE(,TYPE2...) ignore various comma separated message types
112 --show-types show the specific message type in the output
113 --max-line-length=n set the maximum line length, (default $max_line_length)
115 requires --strict for use with --file
116 --min-conf-desc-length=n set the min description length, if shorter, warn
117 --tab-size=n set the number of spaces for tab (default $tabsize)
118 --root=PATH PATH to the kernel tree root
119 --no-summary suppress the per-file summary
120 --mailback only produce a report in case of warnings/errors
121 --summary-file include the filename in summary
122 --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of
125 --test-only=WORD report only warnings/errors containing WORD
127 --fix EXPERIMENTAL - may create horrible results
128 If correctable single-line errors exist, create
129 "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
132 --fix-inplace EXPERIMENTAL - may create horrible results
133 Is the same as --fix, but overwrites the input
135 --ignore-perl-version override checking of perl version. expect
137 --codespell Use the codespell dictionary for spelling/typos
139 --codespellfile Use this codespell dictionary
140 --typedefsfile Read additional types from this file
141 --color[=WHEN] Use colors 'always', 'never', or only when output
143 --kconfig-prefix=WORD use WORD as a prefix for Kconfig symbols (default
145 -h, --help, --version display this help and exit
147 When FILE is - read standard input.
153 sub uniq {
158 sub list_types {
222 if (-f $conf) {
247 sub load_docs {
288 # Prevent --color by itself from consuming other arguments
290 if ($_ eq "--color" || $_ eq "-color") {
291 $_ = "--color=$color";
300 'fixes-tag!' => \$chk_fixes_tag,
311 'show-types!' => \$show_types,
312 'list-types!' => \$list_types,
313 'max-line-length=i' => \$max_line_length,
314 'min-conf-desc-length=i' => \$min_conf_desc_length,
315 'tab-size=i' => \$tabsize,
319 'summary-file!' => \$summary_file,
321 'fix-inplace!' => \$fix_inplace,
322 'ignore-perl-version!' => \$ignore_perl_version,
324 'test-only=s' => \$tst_only,
329 'no-color' => \$color, #keep old behaviors of -nocolor
330 'nocolor' => \$color, #keep old behaviors of -nocolor
331 'kconfig-prefix=s' => \${CONFIG_},
339 } elsif (!(-f $codespellfile)) {
352 my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
353 $codespellfile = $codespell_dict if (-f $codespell_dict);
357 # $help is 1 if either -h, --help or --version is passed as option - exitcode: 0
358 # $help is 2 if invalid option is passed - exitcode: 1
359 help($help - 1) if ($help);
361 die "$P: --git cannot be used with --file or --fix\n" if ($git && ($file || $fix));
362 die "$P: --verbose cannot be used with --terse\n" if ($verbose && $terse);
371 $color = (-t STDOUT);
391 #if no filenames are given, push '-' to read patch from stdin
393 push(@ARGV, '-');
396 # skip TAB size 1 to avoid additional checks on $tabsize - 1
399 sub hash_save_array_words {
407 $word =~ tr/[a-z]/[A-Z]/;
412 $hashRef->{$word}++;
416 sub hash_show_words {
451 die "$P: $root: --root does not point at a valid tree\n";
463 print "Must be run from the top-level dir. of a kernel tree\n";
471 [A-Za-z_][A-Za-z\d_]*
472 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
527 our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
532 our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
533 our $Int = qr{[0-9]+$Int_type?};
534 our $Octal = qr{0[0-7]+$Int_type?};
536 our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
537 our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
538 our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
541 our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=};
542 our $Compare = qr{<=|>=|==|!=|<|(?<!-)>};
543 our $Arithmetic = qr{\+|-|\*|\/|%};
546 =>|->|<<|>>|<|>|!|~|
547 &&|\|\||,|\^|\+\+|--|&|\||$Arithmetic
562 [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
563 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
564 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
565 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
566 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
567 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
568 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
572 [\x09\x0A\x0D\x20-\x7E] # ASCII
599 …(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|co…
603 MODULE_[A-Z_]+|
618 Signed-off-by:|
619 Co-developed-by:|
620 Acked-by:|
621 Tested-by:|
622 Reviewed-by:|
623 Reported-by:|
624 Suggested-by:|
646 [=-]*> |
647 <[=-]* |
669 sub edit_distance_min {
677 for my $i (0 .. ($len-1)) {
685 sub get_edit_distance {
689 $str1 =~ s/-//g;
690 $str2 =~ s/-//g;
701 } elsif (substr($str1, $i-1, 1) eq substr($str2, $j-1, 1)) {
702 $distance[$i][$j] = $distance[$i - 1][$j - 1];
704 my $dist1 = $distance[$i][$j - 1]; #insert distance
705 my $dist2 = $distance[$i - 1][$j]; # remove
706 my $dist3 = $distance[$i - 1][$j - 1]; #replace
714 sub find_standard_signature {
717 'Signed-off-by:', 'Co-developed-by:', 'Acked-by:', 'Tested-by:',
718 'Reviewed-by:', 'Reported-by:', 'Suggested-by:'
728 \Qfreedesktop.org/archives/dri-devel\E |
731 \Qmail-archive.com\E |
732 \Qmailman.alsa-project.org/pipermail\E |
820 ["IIO_DEV_ATTR_[A-Z_]+", 1],
826 my $word_pattern = '\b[A-Z]?[a-z]{2,}\b';
832 $mode_perms_search .= $entry->[0];
856 0[0-7][0-7][2367]
890 sub perms_to_octal {
893 return trim($string) if ($string =~ /^\s*0[0-7]{3,3}\s*$/);
904 last if ($lastpos > 0 && ($curpos - length($omatch) != $lastpos));
944 warn "No typos will be found - file '$spelling_file': $!\n";
961 my ($suspect, $fix) = split(/->/, $line);
967 warn "No codespell typos will be found - file '$codespellfile': $!\n";
973 sub read_words {
986 print("$file: '$line' invalid - ignored\n");
1003 or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
1009 or warn "No additional types will be considered - file '$typedefsfile': $!\n";
1013 sub build_types {
1069 our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
1074 (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
1087 sub deparenthesize {
1101 sub seed_camelcase_file {
1104 return if (!(-f $file));
1116 next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/);
1117 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
1119 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
1121 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
1129 sub is_maintained_obsolete {
1132 return 0 if (!$tree || !(-e "$root/scripts/get_maintainer.pl"));
1135 …s{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback…
1141 sub is_SPDX_License_valid {
1144 …return 1 if (!$tree || which("python3") eq "" || !(-x "$root/scripts/spdxcheck.py") || !(-e "$gitr…
1147 my $status = `cd "$root_path"; echo "$license" | scripts/spdxcheck.py -`;
1153 sub seed_camelcase_includes {
1162 if (-e "$gitroot") {
1163 …my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include…
1165 $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
1168 $files = `find $root/include -name "*.h"`;
1175 $camelcase_cache = ".checkpatch-camelcase.date.$last_mod_date";
1178 if ($camelcase_cache ne "" && -f $camelcase_cache) {
1190 if (-e "$gitroot") {
1191 $files = `${git_command} ls-files "include/*.h"`;
1200 unlink glob ".checkpatch-camelcase.*";
1210 sub git_is_single_file {
1213 return 0 if ((which("git") eq "") || !(-e "$gitroot"));
1215 my $output = `${git_command} ls-files -- $filename 2>/dev/null`;
1220 sub git_commit_info {
1223 return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));
1225 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
1236 # git rev-list --remotes | grep -i "^$1" |
1238 # git log --format='%H %s' -1 $line |
1239 # echo "commit $(cut -c 1-12,41-)"
1260 my $fixlinenr = -1;
1263 # For example, HEAD-3 means we need check 'HEAD, HEAD~1, HEAD~2'.
1264 die "$P: No git repository found\n" if ($git && !-e "$gitroot");
1270 if ($commit_expr =~ m/^(.*)-(\d+)$/) {
1271 $git_range = "-$2 $1";
1275 $git_range = "-1 $commit_expr";
1277 my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
1279 $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
1299 open($FILE, '-|', "git format-patch -M --stdout -1 $filename") ||
1300 die "$P: $filename: git format-patch failed - $!\n";
1302 open($FILE, '-|', "diff -u /dev/null $filename") ||
1303 die "$P: $filename: diff failed - $!\n";
1304 } elsif ($filename eq '-') {
1308 die "$P: $filename: open failed - $!\n";
1310 if ($filename eq '-') {
1320 $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
1325 print '-' x length($vname) . "\n";
1327 print '-' x length($vname) . "\n";
1338 $fixlinenr = -1;
1367 sub top_of_kernel_tree {
1377 if (! -e $root . '/' . $check) {
1384 sub parse_email {
1407 # If there's a name left after stripping spaces and
1421 # "John D. (Doe)" - Do not extract
1435 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1443 sub format_email {
1452 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1471 sub reformat_email {
1478 sub same_email_addresses {
1490 sub which {
1494 if (-e "$path/$bin") {
1502 sub which_conf {
1506 if (-e "$path/$conf") {
1514 sub expand_tabs {
1534 sub copy_spacing {
1539 sub line_stats {
1554 sub sanitise_line_reset {
1563 sub sanitise_line {
1656 sub get_quoted_string {
1661 return substr($rawline, $-[0], $+[0] - $-[0]);
1664 sub ctx_statement_block {
1666 my $line = $linenr - 1;
1669 my $coff = $off - 1;
1683 @stack = (['', 0]) if ($#stack == -1);
1691 next if ($lines[$line] =~ /^-/);
1692 $remain--;
1719 ($type, $level) = @{$stack[$#stack - 1]};
1735 $coff = $off + length($1) - 1;
1738 #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n";
1746 $level--;
1760 $level--;
1772 $level--;
1783 $remain--;
1786 my $statement = substr($blk, $soff, $off - $soff + 1);
1787 my $condition = substr($blk, $soff, $coff - $soff + 1);
1795 $line, $remain + 1, $off - $loff + 1, $level);
1798 sub statement_lines {
1811 sub statement_rawlines {
1819 sub statement_block_size {
1841 sub ctx_statement_full {
1852 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
1862 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
1870 sub ctx_block_get {
1873 my $start = $linenr - 1;
1882 next if ($rawlines[$line] =~ /^-/);
1883 $remain--;
1891 $level = $stack[$#stack - 1];
1899 $off--;
1904 $level--;
1920 sub ctx_block_outer {
1926 sub ctx_block {
1932 sub ctx_statement {
1938 sub ctx_block_level {
1943 sub ctx_statement_level {
1949 sub ctx_locate_comment {
1953 my ($current_comment) = ($rawlines[$end_line - 1] =~ m@^\+.*(//.*$)@);
1955 ($current_comment) = ($rawlines[$end_line - 2] =~ m@^[\+ ].*(//.*$)@);
1961 ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
1969 my $line = $rawlines[$linenr - 1];
1989 sub ctx_has_comment {
1993 ##print "LINE: $rawlines[$end_line - 1 ]\n";
1999 sub raw_line {
2002 my $offset = $linenr - 1;
2008 next if (defined($line) && $line =~ /^-/);
2009 $cnt--;
2015 sub get_stat_real {
2026 sub get_stat_here {
2037 sub cat_vet {
2059 sub annotate_reset {
2066 sub annotate_values {
2179 print "PAREN('$1') -> $type\n"
2235 } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) {
2250 if ($1 ne '++' && $1 ne '--') {
2266 sub possible {
2315 sub show_type {
2318 $type =~ tr/[a-z]/[A-Z]/;
2325 sub report {
2351 my @lines = split("\n", $output, -1);
2371 sub report_dump {
2375 sub fixup_current_range {
2378 if ($$lineRef =~ /^\@\@ -\d+,\d+ \+(\d+),(\d+) \@\@/) {
2387 sub fix_inserted_deleted_lines {
2407 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2409 } elsif ($line =~ /^\@\@ -\d+,\d+ \+\d+,\d+ \@\@/) { #new hunk
2417 fixup_current_range(\$lines[$range_last_linenr], $delta_offset--, -1);
2438 sub fix_insert_line {
2448 sub fix_delete_line {
2459 sub ERROR {
2469 sub WARN {
2479 sub CHK {
2490 sub check_absolute_file {
2498 if (-f "$root/$file") {
2503 if (! -f _) {
2509 substr($prefix, -length($file)) = '';
2518 sub trim {
2526 sub ltrim {
2534 sub rtrim {
2542 sub string_find_replace {
2550 sub tabify {
2554 my $max_spaces_before_tab = $source_indent - 1;
2557 #convert leading spaces to tabs
2559 #Remove spaces before a tab
2565 sub pos_last_openparen {
2576 return -1;
2584 $pos += length($1) - 1;
2587 } elsif (index($string, '(') == -1) {
2595 sub get_raw_comment {
2599 for my $i (0 .. (length($line) - 1)) {
2608 sub exclude_global_initialisers {
2617 sub process {
2640 my $is_binding_patch = -1;
2643 my $has_patch_separator = 0; #Found a --- line
2652 my $last_git_commit_id_linenr = -1;
2655 my $last_coalesced_string_linenr = -1;
2684 # Pre-scan the patch sanitizing the lines.
2685 # Pre-scan the patch looking for any __setup documentation.
2704 if ($1 =~ m@Documentation/admin-guide/kernel-parameters.txt$@) {
2709 if ($rawline =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
2710 $realline=$1-1;
2725 next if (defined $rawlines[$ln - 1] &&
2726 $rawlines[$ln - 1] =~ /^-/);
2727 $cnt--;
2728 #print "RAW<$rawlines[$ln - 1]>\n";
2729 last if (!defined $rawlines[$ln - 1]);
2730 if ($rawlines[$ln - 1] =~ m@(/\*|\*/)@ &&
2731 $rawlines[$ln - 1] !~ m@"[^"]*(?:/\*|\*/)[^"]*"@) {
2754 # simplify matching -- only bother with positive lines.
2760 $realcnt-- if ($line =~ /^(?:\+| |$)/);
2766 #print "-->$line\n";
2777 $fixlinenr = -1;
2782 $sline =~ s/$;/ /g; #with comments as spaces
2784 my $rawline = $rawlines[$linenr - 1];
2789 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2791 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2797 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
2801 $realline=$1-1;
2826 $realcnt-- if ($realcnt != 0);
2839 $realcnt--;
2849 if ($line =~ /^diff --git.*?(\S+)$/) {
2861 -e "$root/$p1_prefix") {
2863 "patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
2899 $is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
2901 if (($last_binding_patch != -1) &&
2904 …udes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst\n");
2927 "Missing commit description - Add an appropriate one\n");
2935 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2936 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2938 "Avoid using diff content in the commit message - patch(1) might not work\n" . $herecurr);
2953 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2959 $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
2965 if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
3004 if ($line =~ /^---$/) {
3017 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
3028 "Non-standard signature: $sign_off\n" . $herecurr);
3031 "Non-standard signature: '$sign_off' - perhaps '$suggested_signature'?\n" . $herecurr) &&
3045 if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
3109 $cur_name =~ s/[a-zA-Z\s\-\"]+//g;
3159 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
3160 if ($sign_off =~ /^co-developed-by:$/i) {
3163 … "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . $herecurr);
3167 "Co-developed-by: must be immediately followed by Signed-off-by:\n" . $herecurr);
3168 } elsif ($rawlines[$linenr] !~ /^signed-off-by:\s*(.*)/i) {
3170 …"Co-developed-by: must be immediately followed by Signed-off-by:\n" . $herecurr . $rawlines[$linen…
3173 …"Co-developed-by and Signed-off-by: name/email do not match\n" . $herecurr . $rawlines[$linenr] . …
3177 # check if Reported-by: is followed by a Closes: tag
3178 if ($sign_off =~ /^reported(?:|-and-tested)-by:$/i) {
3181 …"Reported-by: should be immediately followed by Closes: with a URL to the report\n" . $herecurr . …
3184 …"Reported-by: should be immediately followed by Closes: with a URL to the report\n" . $herecurr . …
3202 $line =~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($balanced_parens))?/i) {
3210 $title = substr($3, 1, -1);
3212 $title = substr($title, 1, -1);
3221 my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
3223 my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/i);
3224 my $id_case = not ($orig_commit !~ /[A-F]/);
3233 …"Please use correct Fixes: style 'Fixes: <12+ chars of sha1> (\"<title line>\")' - ie: '$fixed'\n"…
3247 # Check for Gerrit Change-Ids not in any patch context
3248 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
3250 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
3261 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
3262 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
3263 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
3271 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
3273 $line =~ /^\s*(?:[\w\.\-\+]*\/)++[\w\.\-\+]+:/ ||
3294 "Patch version information should be after the --- line\n" . $herecurr);
3323 # commit <SHA-1 hash length 12+ chars> ("Complete commit subject")
3326 # bare SHA-1 hash with minimum length of 5. It also avoids several types of
3327 # possible SHA-1 matches.
3332 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
3333 $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
3334 (($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3335 … /\bcommit\s*$/i && defined($rawlines[$linenr]) && $rawlines[$linenr] =~ /^\s*[0-9a-f]{5,}\b/i)) ||
3336 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
3337 $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
3338 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
3353 if ($line =~ /(?:\bcommit\s+[0-9a-f]{5,}|\bcommit\s*$)/i) {
3355 if ($input =~ /\bcommit\s+[0-9a-f]{5,}\s*($balanced_parens)/i) {
3359 $orig_desc = substr($orig_desc, 1, -1);
3361 $orig_desc = substr($orig_desc, 1, -1);
3373 if ($input =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
3376 $short = 0 if ($input =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3377 $long = 1 if ($input =~ /\bcommit\s+[0-9a-f]{41,}/i);
3378 $space = 0 if ($input =~ /\bcommit [0-9a-f]/i);
3379 $case = 0 if ($input =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3380 } elsif ($input =~ /\b([0-9a-f]{12,40})\b/i) {
3389 $last_git_commit_id_linenr != $linenr - 1) {
3391 …it commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}omm…
3400 …"Use lore.kernel.org archive links when possible - see https://lore.kernel.org/lists.html\n" . $he…
3406 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
3407 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
3420 …"DT bindings should be in DT schema format. See: Documentation/devicetree/bindings/writing-schema.…
3424 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
3430 # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
3440 "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
3447 $rawline =~ /^(?:commit\b|from\b|[\w-]+:)/i)) {
3453 # Check if there is UTF-8 in a commit log when a mail header has explicitly
3456 $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
3457 $1 !~ /utf-8/i) {
3464 "8-bit UTF-8 used in possible commit log\n" . $herecurr);
3484 while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) {
3487 my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
3490 $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
3491 $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
3495 "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr) &&
3497 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
3503 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
3514 # avoid false positive from list command eg, '-rw-r--r-- 1 root root'
3516 $rawline !~ /[bcCdDlMnpPs\?-][rwxsStT-]{9}/) {
3522 my $start_pos = $-[1];
3535 $start_char = substr($rawline, $start_pos - 1, 1) if ($start_pos > ($in_commit_log ? 0 : 1));
3539 next if (index(" \t.,;?!", $end_char) == -1);
3542 if ($first =~ /\b[0-9a-f]{2,}\b/i) {
3567 # ignore non-hunk lines and lines being removed
3568 next if (!$hunk_line || $line =~ /^-/);
3616 next if ($f =~ /^-/);
3646 my $stat_real = get_stat_real($linenr, $ln - 1);
3655 if ($rawline =~ /^\+[A-Z]:/ &&
3656 $rawline !~ /^\+[A-Z]:\t\S/) {
3660 $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
3665 if ($rawline =~ /^\+[A-Z]:/ &&
3666 $prevrawline =~ /^[\+ ][A-Z]:/) {
3667 $rawline =~ /^\+([A-Z]):\s*(.*)/;
3670 $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
3681 "Misordered MAINTAINERS entry - list '$cur:' before '$prev:'\n" . $hereprev);
3686 "Misordered MAINTAINERS entry - list file patterns in alphabetic order\n" . $hereprev);
3693 ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
3696 'EXTRA_AFLAGS' => 'asflags-y',
3697 'EXTRA_CFLAGS' => 'ccflags-y',
3698 'EXTRA_CPPFLAGS' => 'cppflags-y',
3699 'EXTRA_LDFLAGS' => 'ldflags-y',
3703 … of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacem…
3711 my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
3714 my $vp_file = $dt_path . "vendor-prefixes.yaml";
3718 $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
3720 $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
3721 `grep -Erq "$compat|$compat2|$compat3" $dt_path`;
3724 "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
3727 next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
3729 `grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;
3732 … "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
3755 $rawline =~ /SPDX-License-Identifier:/ &&
3762 $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
3764 … "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3765 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
3772 $spdx_license !~ /GPL-2\.0(?:-only)? OR BSD-2-Clause/) {
3777 "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr) &&
3779 …$fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-…
3782 if ($realfile =~ m@^include/dt-bindings/@ &&
3783 $spdx_license !~ /GPL-2\.0(?:-only)? OR \S+/) {
3785 "DT binding headers should be licensed (GPL-2.0-only OR .*)\n" . $herecurr);
3800 # check for using SPDX-License-Identifier on the wrong line number
3802 $rawline =~ /\bSPDX-License-Identifier:/ &&
3803 substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
3805 "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
3832 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3847 } elsif ($rawline =~ /^\+.*\b[a-z][\w\.\+\-]*:\/\/\S+/i) {
3854 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3859 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3883 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3885 … range of code via 'SYM_*_START/END' annotations; see Documentation/core-api/asm-annotations.rst\n…
3924 $fixed[$fixlinenr - 1] .= " $operator";
3935 # insert logical operator at last non-comment, non-whitepsace char on previous line
3937 my $line_end = substr($prevrawline, $-[0]);
3938 $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E$/ $operator$line_end/;
3956 # check multi-line statement indentation matches previous line
4054 $line =~ /^\+[a-z_]*init/ ||
4055 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
4069 $last_blank_line != ($linenr - 1)) {
4125 # check for spaces at the beginning of a line.
4133 "please, no spaces at the start of a line\n" . $herevet) &&
4223 (!defined $lines[$realline_next - 1] ||
4224 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
4304 …if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $li…
4311 "Too many leading tabs - consider code refactoring\n" . $herecurr);
4314 my $ctx_cnt = $realcnt - $#ctx - 1;
4321 defined $lines[$ctx_ln - 1] &&
4322 $lines[$ctx_ln - 1] =~ /^-/)) {
4324 $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/);
4329 #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
4331 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
4334 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
4338 defined $lines[$ctx_ln - 1])
4340 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
4344 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
4350 …if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /…
4398 my $cond_ptr = -1;
4461 $prev_values = substr($curr_values, -1);
4469 if ($line =~ /^\+\s*(?:$Declare)?([A-Za-z_][A-Za-z\d_]*)\s*=/) {
4473 "Do not use self-assignments to avoid compiler warnings\n" . $herecurr);
4478 if ($prevline =~ /^\+.*$Lval\s*(?:\.|->)\s*$/ &&
4480 $prevline =~ /($Lval\s*(?:\.|->))\s*$/;
4486 "Avoid multiple line dereference - prefer '$ref'\n" . $hereprev);
4542 fix_delete_line($fixlinenr - 1, $prevrawline);
4588 #print "APW <$lines[$realline_next - 1]>\n";
4590 exists $lines[$realline_next - 1] &&
4592 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4599 if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
4612 #print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n";
4621 #print "FOO B <$lines[$linenr - 1]>\n";
4716 "Move const after static - use 'static const $1'\n" . $herecurr) &&
4723 # check for non-global char *foo[] = {"bar", ...} declarations.
4746 "Bad function definition - $1() should probably be $1(void)\n" . $herecurr) &&
4773 # '*'s should not have spaces between.
4798 # '*'s should not have spaces between.
4801 # Modifiers should have spaces.
4820 …e =~ /\b(?!AA_|BUILD_|DCCP_|IDA_|KVM_|RWLOCK_|snd_|SPIN_)(?:[a-zA-Z_]*_)?BUG(?:_ON)?(?:_[A-Z_]+)?\…
4824 …"Do not crash the kernel unless it is absolutely unavoidable--use WARN_ON_ONCE() plus recovery cod…
4840 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4846 if ($line =~ /\b(printk(_once|_ratelimited)?)\s*\(\s*KERN_([A-Z]+)/) {
4862 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4924 fix_delete_line($fixlinenr - 1, $prevrawline);
4957 # the $Declare variable will capture all spaces after the type
4979 # "Multiple spaces after return type\n" . $herecurr);
5017 # 1. with a type on the left -- int [] a;
5018 # 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
5019 # 3. inside a curly brace -- = { [0...10] = 5 }
5021 my ($where, $prefix) = ($-[1], $1);
5034 # check for spaces between functions and their parentheses.
5037 my $ctx_before = substr($line, 0, $-[1]);
5040 # Ignore those directives where spaces _are_ permitted.
5047 # cpp #define statements have non-optional spaces, ie
5076 \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
5077 =>|->|<<|>>|<|>|=|!|~|
5078 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%|
5099 my $last_after = -1;
5177 # No spaces for:
5178 # ->
5179 } elsif ($op eq '->') {
5182 "spaces prohibited around that '$op' $at\n" . $hereptr)) {
5221 # '*' as part of a type definition -- reported already.
5229 $opv eq '*U' || $opv eq '-U' ||
5231 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
5254 # unary ++ and unary -- are allowed no space on one side.
5255 } elsif ($op eq '++' or $op eq '--') {
5282 # << and >> may either have or not have spaces both sides
5285 $op eq '+' or $op eq '-' or
5292 "spaces preferred around that '$op' $at\n" . $hereptr)) {
5315 # A colon needs no spaces before when it is
5326 # All the others need spaces both sides.
5353 "spaces required around that '$op' $at\n" . $hereptr)) {
5380 # check for whitespace before a non-naked semicolon
5481 # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar
5493 # ie: (foo->bar)(); should be foo->bar();
5494 # but not "if (foo->bar) (" to avoid some false positives
5512 my $test = substr($2, 1, -1);
5536 if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
5537 $sline !~ /^. [A-Za-z\d_][A-Za-z\d_]*:/ &&
5576 # at end-of-function, with the previous line a single leading tab, then return;
5581 $lines[$linenr - 3] =~ /^[ +]/ &&
5582 $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
5587 # if statements using unnecessary parentheses - ie: if ((foo == bar))
5595 $msg = " - maybe == should be = ?" if ($comp eq "==");
5606 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5613 $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&
5631 if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
5635 "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
5649 # Check for illegal assignment in if conditional -- and check for trailing
5664 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
5666 statement_rawlines($whitespace) - 1;
5746 \s*0[xX][0-9]+\s*
5750 \s*0[xX][0-9]+\s*
5791 fix_delete_line($fixlinenr - 1, $prevrawline);
5817 fix_delete_line($fixlinenr - 1, $prevrawline);
5835 $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
5839 $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ &&
5841 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
5846 $var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-Z0-9_]+)?$/ &&
5848 $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
5851 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
5868 #no spaces allowed after \ in define
5882 if (-f "$root/$checkfile" &&
5886 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
5899 # multi-statement macros should be enclosed in a do while loop, grab the
5914 #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n";
5925 $define_args = substr($define_args, 1, length($define_args) - 2);
5972 $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(),
5973 $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo();
5974 …$dstat !~ /^[!~-]?(?:$Lval|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo // foo->bar // f…
5983 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
5990 …"Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic d…
5993 … "Macros with multiple statements should be enclosed in a do - while loop\n" . "$herectx");
6001 # Make $define_stmt single line, comment-free, etc
6029 "Macro argument reuse '$arg' - possible side-effects?\n" . "$herectx");
6042 "Argument '$arg' is not used in function-like macro\n" . "$herectx");
6072 # single-statement macros do not need to be enclosed in do while (0) loop,
6126 my $ln = $linenr - 1;
6131 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
6132 my $offset = statement_rawlines($whitespace) - 1;
6141 $ln += statement_rawlines($block) - 1;
6178 if (!defined $suppress_ifbraces{$linenr - 1} &&
6182 # Check the pre-context.
6183 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
6189 ctx_statement_full($linenr, $realcnt, $-[0]);
6209 # Check the post-context.
6216 #print "APW: ALLOWED: chunk-1 block<$block>\n";
6240 fix_delete_line($fixlinenr - 1, $prevrawline);
6255 …"Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst\n" . …
6258 # Check for user-visible strings broken across lines, which breaks the ability
6264 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
6269 $last_coalesced_string_linenr != $linenr - 1) {
6276 fix_delete_line($fixlinenr - 1, $prevrawline);
6281 fix_insert_line($fixlinenr - 1, $fixedline);
6298 # This does not work very well for -f --file checking as it depends on patch
6299 # context providing the function name or a single line form for in-file
6314 "Unnecessary ftrace-like logging - prefer using ftrace\n" . $herecurr) &&
6320 # check for spaces before a quoted newline
6330 # concatenated string without spaces between elements
6331 if ($line =~ /$String[A-Z_]/ ||
6332 ($line =~ /([A-Za-z0-9_]+)$String/ && $1 !~ /^[Lu]$/)) {
6334 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
6337 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
6338 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
6339 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
6350 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
6351 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
6356 # check for non-standard and hex prefixed decimal printf formats
6360 my $string = substr($rawline, $-[1], $+[1] - $-[1]);
6365 "\%L$1 is non-standard C, use %ll$1\n" . $herecurr);
6371 "%Z$1 is non-standard C, use %z$1\n" . $herecurr);
6411 if ($lines[$linenr - 2] =~ /^\+(\t*)if\s*\(\s*$tested\s*\)\s*$/) {
6416 if ($lines[$linenr - 1] =~ /^\+(\t+)$func\s*\(\s*$tested\s*\)\s*;\s*$/) {
6425 fix_delete_line($fixlinenr - 1, $prevrawline);
6438 my $testline = $lines[$linenr - 3];
6440 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
6452 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
6475 while ($stat_real =~ /[^\"%]*(%[\#\d\.\*\-]*(h+)[idux])/g) {
6478 my $lineoff = substr($stat_real, 0, $-[1]) =~ tr@\n@@;
6494 … "Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr);
6558 # check for __read_mostly with const non-pointer (should just be const)
6591 "long udelay - prefer mdelay; see function description of mdelay().\n" . $herecurr);
6672 if ($realfile !~ m@^include/asm-generic/@ &&
6677 "__smp memory barriers shouldn't be used outside barrier.h and asm-generic\n" . $herecurr);
6697 … m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
6842 …"Unnecessary typecast of c90 int constant - '$cast$const' could be '$const$suffix'\n" . $herecurr)…
6896 my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0));
6925 $use = " - use %pS instead";
6928 $use = " - '%pA' is only intended to be used from Rust code";
7001 "Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88\n" . $herecurr);
7007 "Prefer strscpy over strlcpy - see: https://github.com/KSPP/linux/issues/89\n" . $herecurr);
7013 …"Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/iss…
7150 "found a file-scoped extern type:$st_type name:$st_name in .c file\n"
7204 …"__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.txt\n" . $here…
7211 … "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
7240 !($r1 =~ /^$Constant$/ || $r1 =~ /^[A-Z_][A-Z0-9_]*$/)) {
7295 …if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:…
7308 'lint -fallthrough[ \t]*',
7309 'intentional(?:ly)?[ \t]*fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)',
7310 '(?:else,?\s*)?FALL(?:S | |-)?THR(?:OUGH|U|EW)[ \t.!]*(?:-[^\n\r]*)?',
7311 'Fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7312 'fall(?:s | |-)?thr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7349 "Use of the '$1' macro makes the build non-deterministic\n" . $herecurr);
7355 "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr);
7438 …"usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_po…
7444 … "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr);
7456 substr($rawline, $-[6], $+[6] - $-[6]) !~ /\\n"$/) {
7457 my $offset = $+[6] - 1;
7469 …"Use C99 flexible arrays - see https://docs.kernel.org/process/deprecated.html#zero-length-and-one…
7471 $fixed[$fixlinenr - 1] =~ s/\[\s*0\s*\]/[]/;
7523 "lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
7538 …E_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*…
7600 my $func = $entry->[0];
7601 my $arg_pos = $entry->[1];
7609 $arg_pos--;
7659 …"Prefer \"GPL\" over \"GPL v2\" - see commit bf7fbeeae6db (\"module: Cure the MODULE_LICENSE \"GPL…
7675 if ($#rawlines == -1) {
7685 # This is not a patch, and we are in 'no-patch' mode so
7691 if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
7693 "Does not appear to be a unified-diff format patch\n");
7704 "Missing Signed-off-by: line(s)\n");
7707 # 0 -> missing sign off
7708 # 1 -> sign off identical
7709 # 2 -> names and addresses match, comments mismatch
7710 # 3 -> addresses match, names different
7711 # 4 -> names match, addresses different
7712 # 5 -> names match, addresses excluding subaddress details (refer RFC 5233) match
7714 my $sob_msg = "'From: $author' != 'Signed-off-by: $author_sob'";
7718 "Missing Signed-off-by: line by nominal patch author '$author'\n");
7721 "From:/Signed-off-by: email comments mismatch: $sob_msg\n");
7724 "From:/Signed-off-by: email name mismatch: $sob_msg\n");
7727 "From:/Signed-off-by: email address mismatch: $sob_msg\n");
7730 "From:/Signed-off-by: email subaddress mismatch: $sob_msg\n");
7749 mechanically convert to the typical style using --fix or --fix-inplace.
7768 $newfile .= ".EXPERIMENTAL-checkpatch-fixes" if (!$fix_inplace);
7792 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'