diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ec9bbf863d50..6e0f1ec0d6f2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -3233,21 +3233,10 @@ sub process { | |||
| 3233 | } | 3233 | } |
| 3234 | 3234 | ||
| 3235 | # Return is not a function. | 3235 | # Return is not a function. |
| 3236 | if (defined($stat) && $stat =~ /^.\s*return(\s*)(\(.*);/s) { | 3236 | if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { |
| 3237 | my $spacing = $1; | 3237 | my $spacing = $1; |
| 3238 | my $value = $2; | 3238 | if ($^V && $^V ge 5.10.0 && |
| 3239 | 3239 | $stat =~ /^.\s*return\s*$balanced_parens\s*;\s*$/) { | |
| 3240 | # Flatten any parentheses | ||
| 3241 | $value =~ s/\(/ \(/g; | ||
| 3242 | $value =~ s/\)/\) /g; | ||
| 3243 | while ($value =~ s/\[[^\[\]]*\]/1/ || | ||
| 3244 | $value !~ /(?:$Ident|-?$Constant)\s* | ||
| 3245 | $Compare\s* | ||
| 3246 | (?:$Ident|-?$Constant)/x && | ||
| 3247 | $value =~ s/\([^\(\)]*\)/1/) { | ||
| 3248 | } | ||
| 3249 | #print "value<$value>\n"; | ||
| 3250 | if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) { | ||
| 3251 | ERROR("RETURN_PARENTHESES", | 3240 | ERROR("RETURN_PARENTHESES", |
| 3252 | "return is not a function, parentheses are not required\n" . $herecurr); | 3241 | "return is not a function, parentheses are not required\n" . $herecurr); |
| 3253 | 3242 | ||
| @@ -3256,6 +3245,7 @@ sub process { | |||
| 3256 | "space required before the open parenthesis '('\n" . $herecurr); | 3245 | "space required before the open parenthesis '('\n" . $herecurr); |
| 3257 | } | 3246 | } |
| 3258 | } | 3247 | } |
| 3248 | |||
| 3259 | # Return of what appears to be an errno should normally be -'ve | 3249 | # Return of what appears to be an errno should normally be -'ve |
| 3260 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { | 3250 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { |
| 3261 | my $name = $1; | 3251 | my $name = $1; |
