projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
script: improve markup_oops.pl to also decode oopses in modules
[firefly-linux-kernel-4.4.55.git]
/
scripts
/
checkpatch.pl
diff --git
a/scripts/checkpatch.pl
b/scripts/checkpatch.pl
index a521d493b0c8600790d20b9574fc445d98f18d4a..7bed4ed2c5197c5d360533665dcea69bc6446109 100755
(executable)
--- a/
scripts/checkpatch.pl
+++ b/
scripts/checkpatch.pl
@@
-10,7
+10,7
@@
use strict;
my $P = $0;
$P =~ s@.*/@@g;
my $P = $0;
$P =~ s@.*/@@g;
-my $V = '0.2
5
';
+my $V = '0.2
6
';
use Getopt::Long qw(:config no_auto_abbrev);
use Getopt::Long qw(:config no_auto_abbrev);
@@
-69,7
+69,9
@@
my $dbg_possible = 0;
my $dbg_type = 0;
my $dbg_attr = 0;
for my $key (keys %debug) {
my $dbg_type = 0;
my $dbg_attr = 0;
for my $key (keys %debug) {
- eval "\${dbg_$key} = '$debug{$key}';"
+ ## no critic
+ eval "\${dbg_$key} = '$debug{$key}';";
+ die "$@" if ($@);
}
if ($terse) {
}
if ($terse) {
@@
-206,9
+208,9
@@
my @dep_includes = ();
my @dep_functions = ();
my $removal = "Documentation/feature-removal-schedule.txt";
if ($tree && -f "$root/$removal") {
my @dep_functions = ();
my $removal = "Documentation/feature-removal-schedule.txt";
if ($tree && -f "$root/$removal") {
- open(
REMOVE, "<
$root/$removal") ||
+ open(
my $REMOVE, '<', "
$root/$removal") ||
die "$P: $removal: open failed - $!\n";
die "$P: $removal: open failed - $!\n";
- while (<REMOVE>) {
+ while (<
$
REMOVE>) {
if (/^Check:\s+(.*\S)/) {
for my $entry (split(/[, ]+/, $1)) {
if ($entry =~ m@include/(.*)@) {
if (/^Check:\s+(.*\S)/) {
for my $entry (split(/[, ]+/, $1)) {
if ($entry =~ m@include/(.*)@) {
@@
-220,17
+222,21
@@
if ($tree && -f "$root/$removal") {
}
}
}
}
}
}
+ close($REMOVE);
}
my @rawlines = ();
my @lines = ();
my $vname;
for my $filename (@ARGV) {
}
my @rawlines = ();
my @lines = ();
my $vname;
for my $filename (@ARGV) {
+ my $FILE;
if ($file) {
if ($file) {
- open(
FILE, "diff -u /dev/null $filename|
") ||
+ open(
$FILE, '-|', "diff -u /dev/null $filename
") ||
die "$P: $filename: diff failed - $!\n";
die "$P: $filename: diff failed - $!\n";
+ } elsif ($filename eq '-') {
+ open($FILE, '<&STDIN');
} else {
} else {
- open(
FILE, "<
$filename") ||
+ open(
$FILE, '<', "
$filename") ||
die "$P: $filename: open failed - $!\n";
}
if ($filename eq '-') {
die "$P: $filename: open failed - $!\n";
}
if ($filename eq '-') {
@@
-238,11
+244,11
@@
for my $filename (@ARGV) {
} else {
$vname = $filename;
}
} else {
$vname = $filename;
}
- while (<FILE>) {
+ while (<
$
FILE>) {
chomp;
push(@rawlines, $_);
}
chomp;
push(@rawlines, $_);
}
- close(FILE);
+ close(
$
FILE);
if (!process($filename)) {
$exit = 1;
}
if (!process($filename)) {
$exit = 1;
}
@@
-2048,7
+2054,7
@@
sub process {
$line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
my ($s, $c) = ($stat, $cond);
$line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
my ($s, $c) = ($stat, $cond);
- if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
+ if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/
s
) {
ERROR("do not use assignment in if condition\n" . $herecurr);
}
ERROR("do not use assignment in if condition\n" . $herecurr);
}
@@
-2509,6
+2515,11
@@
sub process {
if ($line =~ /^.\s*__initcall\s*\(/) {
WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
}
if ($line =~ /^.\s*__initcall\s*\(/) {
WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
}
+# check for struct file_operations, ensure they are const.
+ if ($line =~ /\bstruct\s+file_operations\b/ &&
+ $line !~ /\bconst\b/) {
+ WARN("struct file_operations should normally be const\n" . $herecurr);
+ }
# use of NR_CPUS is usually wrong
# ignore definitions of NR_CPUS and usage to define arrays as likely right
# use of NR_CPUS is usually wrong
# ignore definitions of NR_CPUS and usage to define arrays as likely right