Commit 21caa13c02d67f755fad50370996c489c34a9b15

Authored by Andy Whitcroft
Committed by Linus Torvalds
1 parent 2b6db5cb65

checkpatch: fix the perlcritic errors

Clean up checkpatch using perlcritic.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 13 additions and 7 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -69,7 +69,9 @@
69 69 my $dbg_type = 0;
70 70 my $dbg_attr = 0;
71 71 for my $key (keys %debug) {
72   - eval "\${dbg_$key} = '$debug{$key}';"
  72 + ## no critic
  73 + eval "\${dbg_$key} = '$debug{$key}';";
  74 + die "$@" if ($@);
73 75 }
74 76  
75 77 if ($terse) {
76 78  
... ... @@ -206,9 +208,9 @@
206 208 my @dep_functions = ();
207 209 my $removal = "Documentation/feature-removal-schedule.txt";
208 210 if ($tree && -f "$root/$removal") {
209   - open(REMOVE, "<$root/$removal") ||
  211 + open(my $REMOVE, '<', "$root/$removal") ||
210 212 die "$P: $removal: open failed - $!\n";
211   - while (<REMOVE>) {
  213 + while (<$REMOVE>) {
212 214 if (/^Check:\s+(.*\S)/) {
213 215 for my $entry (split(/[, ]+/, $1)) {
214 216 if ($entry =~ m@include/(.*)@) {
215 217  
216 218  
217 219  
218 220  
... ... @@ -220,17 +222,21 @@
220 222 }
221 223 }
222 224 }
  225 + close($REMOVE);
223 226 }
224 227  
225 228 my @rawlines = ();
226 229 my @lines = ();
227 230 my $vname;
228 231 for my $filename (@ARGV) {
  232 + my $FILE;
229 233 if ($file) {
230   - open(FILE, "diff -u /dev/null $filename|") ||
  234 + open($FILE, '-|', "diff -u /dev/null $filename") ||
231 235 die "$P: $filename: diff failed - $!\n";
  236 + } elsif ($filename eq '-') {
  237 + open($FILE, '<&STDIN');
232 238 } else {
233   - open(FILE, "<$filename") ||
  239 + open($FILE, '<', "$filename") ||
234 240 die "$P: $filename: open failed - $!\n";
235 241 }
236 242 if ($filename eq '-') {
237 243  
... ... @@ -238,11 +244,11 @@
238 244 } else {
239 245 $vname = $filename;
240 246 }
241   - while (<FILE>) {
  247 + while (<$FILE>) {
242 248 chomp;
243 249 push(@rawlines, $_);
244 250 }
245   - close(FILE);
  251 + close($FILE);
246 252 if (!process($filename)) {
247 253 $exit = 1;
248 254 }