summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2018-08-22 00:57:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-22 13:52:48 -0400
commit5b57980de6b228696dfaf70ad50a8550fbb14fc7 (patch)
tree31287b2ad89ad2b9860b0b02d013f7d5db5255b4 /scripts/checkpatch.pl
parent79682c0c00893c683678d85a402392b75e90311d (diff)
checkpatch: improve runtime execution speed a little
checkpatch repeatedly uses a runtime minimum version check that validates the minimum perl version required for a regex match by using a "$^V ge 5.10.0" runtime string match. Only perform that minimum version test once and store the result to reduce string matching time. This reduces runtime execution time for patches or files with high line counts. An example runtime improvement: new: $ time ./scripts/checkpatch.pl -f drivers/net/ethernet/intel/i40e/i40e_main.c > /dev/null real 0m11.856s user 0m11.831s sys 0m0.025s old: $ time ./scripts/checkpatch.pl -f drivers/net/ethernet/intel/i40e/i40e_main.c > /dev/null real 0m13.330s user 0m13.282s sys 0m0.049s Link: http://lkml.kernel.org/r/db21aa9703833bad65ab70cc4e8a78da5b399138.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl66
1 files changed, 33 insertions, 33 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f2e00dc0ae89..0f9788ab988b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -240,11 +240,11 @@ $check_orig = $check;
240 240
241my $exit = 0; 241my $exit = 0;
242 242
243my $perl_version_ok = 1;
243if ($^V && $^V lt $minimum_perl_version) { 244if ($^V && $^V lt $minimum_perl_version) {
245 $perl_version_ok = 0;
244 printf "$P: requires at least perl version %vd\n", $minimum_perl_version; 246 printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
245 if (!$ignore_perl_version) { 247 exit(1) if (!$ignore_perl_version);
246 exit(1);
247 }
248} 248}
249 249
250#if no filenames are given, push '-' to read patch from stdin 250#if no filenames are given, push '-' to read patch from stdin
@@ -1026,11 +1026,11 @@ if (!$quiet) {
1026 hash_show_words(\%use_type, "Used"); 1026 hash_show_words(\%use_type, "Used");
1027 hash_show_words(\%ignore_type, "Ignored"); 1027 hash_show_words(\%ignore_type, "Ignored");
1028 1028
1029 if ($^V lt 5.10.0) { 1029 if (!$perl_version_ok) {
1030 print << "EOM" 1030 print << "EOM"
1031 1031
1032NOTE: perl $^V is not modern enough to detect all possible issues. 1032NOTE: perl $^V is not modern enough to detect all possible issues.
1033 An upgrade to at least perl v5.10.0 is suggested. 1033 An upgrade to at least perl $minimum_perl_version is suggested.
1034EOM 1034EOM
1035 } 1035 }
1036 if ($exit) { 1036 if ($exit) {
@@ -3079,7 +3079,7 @@ sub process {
3079 } 3079 }
3080 3080
3081# check indentation starts on a tab stop 3081# check indentation starts on a tab stop
3082 if ($^V && $^V ge 5.10.0 && 3082 if ($perl_version_ok &&
3083 $sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) { 3083 $sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) {
3084 my $indent = length($1); 3084 my $indent = length($1);
3085 if ($indent % 8) { 3085 if ($indent % 8) {
@@ -3092,7 +3092,7 @@ sub process {
3092 } 3092 }
3093 3093
3094# check multi-line statement indentation matches previous line 3094# check multi-line statement indentation matches previous line
3095 if ($^V && $^V ge 5.10.0 && 3095 if ($perl_version_ok &&
3096 $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { 3096 $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
3097 $prevline =~ /^\+(\t*)(.*)$/; 3097 $prevline =~ /^\+(\t*)(.*)$/;
3098 my $oldindent = $1; 3098 my $oldindent = $1;
@@ -3967,7 +3967,7 @@ sub process {
3967 3967
3968# function brace can't be on same line, except for #defines of do while, 3968# function brace can't be on same line, except for #defines of do while,
3969# or if closed on same line 3969# or if closed on same line
3970 if ($^V && $^V ge 5.10.0 && 3970 if ($perl_version_ok &&
3971 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ && 3971 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
3972 $sline !~ /\#\s*define\b.*do\s*\{/ && 3972 $sline !~ /\#\s*define\b.*do\s*\{/ &&
3973 $sline !~ /}/) { 3973 $sline !~ /}/) {
@@ -4578,7 +4578,7 @@ sub process {
4578# check for unnecessary parentheses around comparisons in if uses 4578# check for unnecessary parentheses around comparisons in if uses
4579# when !drivers/staging or command-line uses --strict 4579# when !drivers/staging or command-line uses --strict
4580 if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) && 4580 if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) &&
4581 $^V && $^V ge 5.10.0 && defined($stat) && 4581 $perl_version_ok && defined($stat) &&
4582 $stat =~ /(^.\s*if\s*($balanced_parens))/) { 4582 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
4583 my $if_stat = $1; 4583 my $if_stat = $1;
4584 my $test = substr($2, 1, -1); 4584 my $test = substr($2, 1, -1);
@@ -4615,7 +4615,7 @@ sub process {
4615# return is not a function 4615# return is not a function
4616 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { 4616 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
4617 my $spacing = $1; 4617 my $spacing = $1;
4618 if ($^V && $^V ge 5.10.0 && 4618 if ($perl_version_ok &&
4619 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) { 4619 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
4620 my $value = $1; 4620 my $value = $1;
4621 $value = deparenthesize($value); 4621 $value = deparenthesize($value);
@@ -4642,7 +4642,7 @@ sub process {
4642 } 4642 }
4643 4643
4644# if statements using unnecessary parentheses - ie: if ((foo == bar)) 4644# if statements using unnecessary parentheses - ie: if ((foo == bar))
4645 if ($^V && $^V ge 5.10.0 && 4645 if ($perl_version_ok &&
4646 $line =~ /\bif\s*((?:\(\s*){2,})/) { 4646 $line =~ /\bif\s*((?:\(\s*){2,})/) {
4647 my $openparens = $1; 4647 my $openparens = $1;
4648 my $count = $openparens =~ tr@\(@\(@; 4648 my $count = $openparens =~ tr@\(@\(@;
@@ -4659,7 +4659,7 @@ sub process {
4659# avoid cases like "foo + BAR < baz" 4659# avoid cases like "foo + BAR < baz"
4660# only fix matches surrounded by parentheses to avoid incorrect 4660# only fix matches surrounded by parentheses to avoid incorrect
4661# conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5" 4661# conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5"
4662 if ($^V && $^V ge 5.10.0 && 4662 if ($perl_version_ok &&
4663 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) { 4663 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
4664 my $lead = $1; 4664 my $lead = $1;
4665 my $const = $2; 4665 my $const = $2;
@@ -5084,7 +5084,7 @@ sub process {
5084# do {} while (0) macro tests: 5084# do {} while (0) macro tests:
5085# single-statement macros do not need to be enclosed in do while (0) loop, 5085# single-statement macros do not need to be enclosed in do while (0) loop,
5086# macro should not end with a semicolon 5086# macro should not end with a semicolon
5087 if ($^V && $^V ge 5.10.0 && 5087 if ($perl_version_ok &&
5088 $realfile !~ m@/vmlinux.lds.h$@ && 5088 $realfile !~ m@/vmlinux.lds.h$@ &&
5089 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) { 5089 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
5090 my $ln = $linenr; 5090 my $ln = $linenr;
@@ -5460,7 +5460,7 @@ sub process {
5460 } 5460 }
5461 5461
5462# check for mask then right shift without a parentheses 5462# check for mask then right shift without a parentheses
5463 if ($^V && $^V ge 5.10.0 && 5463 if ($perl_version_ok &&
5464 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ && 5464 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
5465 $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so 5465 $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so
5466 WARN("MASK_THEN_SHIFT", 5466 WARN("MASK_THEN_SHIFT",
@@ -5468,7 +5468,7 @@ sub process {
5468 } 5468 }
5469 5469
5470# check for pointer comparisons to NULL 5470# check for pointer comparisons to NULL
5471 if ($^V && $^V ge 5.10.0) { 5471 if ($perl_version_ok) {
5472 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) { 5472 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
5473 my $val = $1; 5473 my $val = $1;
5474 my $equal = "!"; 5474 my $equal = "!";
@@ -5740,7 +5740,7 @@ sub process {
5740 } 5740 }
5741 5741
5742# Check for __attribute__ weak, or __weak declarations (may have link issues) 5742# Check for __attribute__ weak, or __weak declarations (may have link issues)
5743 if ($^V && $^V ge 5.10.0 && 5743 if ($perl_version_ok &&
5744 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ && 5744 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
5745 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ || 5745 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
5746 $line =~ /\b__weak\b/)) { 5746 $line =~ /\b__weak\b/)) {
@@ -5822,7 +5822,7 @@ sub process {
5822 } 5822 }
5823 5823
5824# check for vsprintf extension %p<foo> misuses 5824# check for vsprintf extension %p<foo> misuses
5825 if ($^V && $^V ge 5.10.0 && 5825 if ($perl_version_ok &&
5826 defined $stat && 5826 defined $stat &&
5827 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s && 5827 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
5828 $1 !~ /^_*volatile_*$/) { 5828 $1 !~ /^_*volatile_*$/) {
@@ -5869,7 +5869,7 @@ sub process {
5869 } 5869 }
5870 5870
5871# Check for misused memsets 5871# Check for misused memsets
5872 if ($^V && $^V ge 5.10.0 && 5872 if ($perl_version_ok &&
5873 defined $stat && 5873 defined $stat &&
5874 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) { 5874 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
5875 5875
@@ -5887,7 +5887,7 @@ sub process {
5887 } 5887 }
5888 5888
5889# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) 5889# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
5890# if ($^V && $^V ge 5.10.0 && 5890# if ($perl_version_ok &&
5891# defined $stat && 5891# defined $stat &&
5892# $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 5892# $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5893# if (WARN("PREFER_ETHER_ADDR_COPY", 5893# if (WARN("PREFER_ETHER_ADDR_COPY",
@@ -5898,7 +5898,7 @@ sub process {
5898# } 5898# }
5899 5899
5900# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar) 5900# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar)
5901# if ($^V && $^V ge 5.10.0 && 5901# if ($perl_version_ok &&
5902# defined $stat && 5902# defined $stat &&
5903# $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 5903# $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5904# WARN("PREFER_ETHER_ADDR_EQUAL", 5904# WARN("PREFER_ETHER_ADDR_EQUAL",
@@ -5907,7 +5907,7 @@ sub process {
5907 5907
5908# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr 5908# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
5909# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr 5909# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
5910# if ($^V && $^V ge 5.10.0 && 5910# if ($perl_version_ok &&
5911# defined $stat && 5911# defined $stat &&
5912# $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 5912# $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5913# 5913#
@@ -5929,7 +5929,7 @@ sub process {
5929# } 5929# }
5930 5930
5931# typecasts on min/max could be min_t/max_t 5931# typecasts on min/max could be min_t/max_t
5932 if ($^V && $^V ge 5.10.0 && 5932 if ($perl_version_ok &&
5933 defined $stat && 5933 defined $stat &&
5934 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { 5934 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
5935 if (defined $2 || defined $7) { 5935 if (defined $2 || defined $7) {
@@ -5953,7 +5953,7 @@ sub process {
5953 } 5953 }
5954 5954
5955# check usleep_range arguments 5955# check usleep_range arguments
5956 if ($^V && $^V ge 5.10.0 && 5956 if ($perl_version_ok &&
5957 defined $stat && 5957 defined $stat &&
5958 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) { 5958 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
5959 my $min = $1; 5959 my $min = $1;
@@ -5969,7 +5969,7 @@ sub process {
5969 } 5969 }
5970 5970
5971# check for naked sscanf 5971# check for naked sscanf
5972 if ($^V && $^V ge 5.10.0 && 5972 if ($perl_version_ok &&
5973 defined $stat && 5973 defined $stat &&
5974 $line =~ /\bsscanf\b/ && 5974 $line =~ /\bsscanf\b/ &&
5975 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ && 5975 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
@@ -5983,7 +5983,7 @@ sub process {
5983 } 5983 }
5984 5984
5985# check for simple sscanf that should be kstrto<foo> 5985# check for simple sscanf that should be kstrto<foo>
5986 if ($^V && $^V ge 5.10.0 && 5986 if ($perl_version_ok &&
5987 defined $stat && 5987 defined $stat &&
5988 $line =~ /\bsscanf\b/) { 5988 $line =~ /\bsscanf\b/) {
5989 my $lc = $stat =~ tr@\n@@; 5989 my $lc = $stat =~ tr@\n@@;
@@ -6055,7 +6055,7 @@ sub process {
6055 } 6055 }
6056 6056
6057# check for function definitions 6057# check for function definitions
6058 if ($^V && $^V ge 5.10.0 && 6058 if ($perl_version_ok &&
6059 defined $stat && 6059 defined $stat &&
6060 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) { 6060 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
6061 $context_function = $1; 6061 $context_function = $1;
@@ -6095,14 +6095,14 @@ sub process {
6095 6095
6096# alloc style 6096# alloc style
6097# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) 6097# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
6098 if ($^V && $^V ge 5.10.0 && 6098 if ($perl_version_ok &&
6099 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { 6099 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
6100 CHK("ALLOC_SIZEOF_STRUCT", 6100 CHK("ALLOC_SIZEOF_STRUCT",
6101 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); 6101 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
6102 } 6102 }
6103 6103
6104# check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc 6104# check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc
6105 if ($^V && $^V ge 5.10.0 && 6105 if ($perl_version_ok &&
6106 defined $stat && 6106 defined $stat &&
6107 $stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) { 6107 $stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) {
6108 my $oldfunc = $3; 6108 my $oldfunc = $3;
@@ -6131,7 +6131,7 @@ sub process {
6131 } 6131 }
6132 6132
6133# check for krealloc arg reuse 6133# check for krealloc arg reuse
6134 if ($^V && $^V ge 5.10.0 && 6134 if ($perl_version_ok &&
6135 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) { 6135 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
6136 WARN("KREALLOC_ARG_REUSE", 6136 WARN("KREALLOC_ARG_REUSE",
6137 "Reusing the krealloc arg is almost always a bug\n" . $herecurr); 6137 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
@@ -6200,7 +6200,7 @@ sub process {
6200 } 6200 }
6201 6201
6202# check for switch/default statements without a break; 6202# check for switch/default statements without a break;
6203 if ($^V && $^V ge 5.10.0 && 6203 if ($perl_version_ok &&
6204 defined $stat && 6204 defined $stat &&
6205 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) { 6205 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
6206 my $cnt = statement_rawlines($stat); 6206 my $cnt = statement_rawlines($stat);
@@ -6317,7 +6317,7 @@ sub process {
6317 } 6317 }
6318 6318
6319# likely/unlikely comparisons similar to "(likely(foo) > 0)" 6319# likely/unlikely comparisons similar to "(likely(foo) > 0)"
6320 if ($^V && $^V ge 5.10.0 && 6320 if ($perl_version_ok &&
6321 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) { 6321 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
6322 WARN("LIKELY_MISUSE", 6322 WARN("LIKELY_MISUSE",
6323 "Using $1 should generally have parentheses around the comparison\n" . $herecurr); 6323 "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
@@ -6360,7 +6360,7 @@ sub process {
6360# check for DEVICE_ATTR uses that could be DEVICE_ATTR_<FOO> 6360# check for DEVICE_ATTR uses that could be DEVICE_ATTR_<FOO>
6361# and whether or not function naming is typical and if 6361# and whether or not function naming is typical and if
6362# DEVICE_ATTR permissions uses are unusual too 6362# DEVICE_ATTR permissions uses are unusual too
6363 if ($^V && $^V ge 5.10.0 && 6363 if ($perl_version_ok &&
6364 defined $stat && 6364 defined $stat &&
6365 $stat =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*,\s*(\w+)\s*,\s*(\w+)\s*\)/) { 6365 $stat =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*,\s*(\w+)\s*,\s*(\w+)\s*\)/) {
6366 my $var = $1; 6366 my $var = $1;
@@ -6420,7 +6420,7 @@ sub process {
6420# specific definition of not visible in sysfs. 6420# specific definition of not visible in sysfs.
6421# o Ignore proc_create*(...) uses with a decimal 0 permission as that means 6421# o Ignore proc_create*(...) uses with a decimal 0 permission as that means
6422# use the default permissions 6422# use the default permissions
6423 if ($^V && $^V ge 5.10.0 && 6423 if ($perl_version_ok &&
6424 defined $stat && 6424 defined $stat &&
6425 $line =~ /$mode_perms_search/) { 6425 $line =~ /$mode_perms_search/) {
6426 foreach my $entry (@mode_permission_funcs) { 6426 foreach my $entry (@mode_permission_funcs) {