aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl33
-rwxr-xr-xscripts/decodecode8
-rwxr-xr-xscripts/get_maintainer.pl2
-rw-r--r--scripts/mod/devicetable-offsets.c3
-rw-r--r--scripts/mod/file2alias.c12
5 files changed, 52 insertions, 6 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4de4bc48493b..b954de58304f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -281,6 +281,7 @@ our $signature_tags = qr{(?xi:
281 Tested-by:| 281 Tested-by:|
282 Reviewed-by:| 282 Reviewed-by:|
283 Reported-by:| 283 Reported-by:|
284 Suggested-by:|
284 To:| 285 To:|
285 Cc: 286 Cc:
286)}; 287)};
@@ -628,6 +629,13 @@ sub sanitise_line {
628 return $res; 629 return $res;
629} 630}
630 631
632sub get_quoted_string {
633 my ($line, $rawline) = @_;
634
635 return "" if ($line !~ m/(\"[X]+\")/g);
636 return substr($rawline, $-[0], $+[0] - $-[0]);
637}
638
631sub ctx_statement_block { 639sub ctx_statement_block {
632 my ($linenr, $remain, $off) = @_; 640 my ($linenr, $remain, $off) = @_;
633 my $line = $linenr - 1; 641 my $line = $linenr - 1;
@@ -1576,7 +1584,8 @@ sub process {
1576# Check for incorrect file permissions 1584# Check for incorrect file permissions
1577 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { 1585 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
1578 my $permhere = $here . "FILE: $realfile\n"; 1586 my $permhere = $here . "FILE: $realfile\n";
1579 if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { 1587 if ($realfile !~ m@scripts/@ &&
1588 $realfile !~ /\.(py|pl|awk|sh)$/) {
1580 ERROR("EXECUTE_PERMISSIONS", 1589 ERROR("EXECUTE_PERMISSIONS",
1581 "do not set execute permissions for source files\n" . $permhere); 1590 "do not set execute permissions for source files\n" . $permhere);
1582 } 1591 }
@@ -2514,8 +2523,8 @@ sub process {
2514 2523
2515# check for whitespace before a non-naked semicolon 2524# check for whitespace before a non-naked semicolon
2516 if ($line =~ /^\+.*\S\s+;/) { 2525 if ($line =~ /^\+.*\S\s+;/) {
2517 CHK("SPACING", 2526 WARN("SPACING",
2518 "space prohibited before semicolon\n" . $herecurr); 2527 "space prohibited before semicolon\n" . $herecurr);
2519 } 2528 }
2520 2529
2521# Check operator spacing. 2530# Check operator spacing.
@@ -3221,7 +3230,7 @@ sub process {
3221 } 3230 }
3222 3231
3223# check for unnecessary blank lines around braces 3232# check for unnecessary blank lines around braces
3224 if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) { 3233 if (($line =~ /^.\s*}\s*$/ && $prevline =~ /^.\s*$/)) {
3225 CHK("BRACES", 3234 CHK("BRACES",
3226 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); 3235 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
3227 } 3236 }
@@ -3373,6 +3382,15 @@ sub process {
3373 "struct spinlock should be spinlock_t\n" . $herecurr); 3382 "struct spinlock should be spinlock_t\n" . $herecurr);
3374 } 3383 }
3375 3384
3385# check for seq_printf uses that could be seq_puts
3386 if ($line =~ /\bseq_printf\s*\(/) {
3387 my $fmt = get_quoted_string($line, $rawline);
3388 if ($fmt !~ /[^\\]\%/) {
3389 WARN("PREFER_SEQ_PUTS",
3390 "Prefer seq_puts to seq_printf\n" . $herecurr);
3391 }
3392 }
3393
3376# Check for misused memsets 3394# Check for misused memsets
3377 if ($^V && $^V ge 5.10.0 && 3395 if ($^V && $^V ge 5.10.0 &&
3378 defined $stat && 3396 defined $stat &&
@@ -3477,6 +3495,13 @@ sub process {
3477 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 3495 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
3478 } 3496 }
3479 3497
3498# check for krealloc arg reuse
3499 if ($^V && $^V ge 5.10.0 &&
3500 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
3501 WARN("KREALLOC_ARG_REUSE",
3502 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
3503 }
3504
3480# check for alloc argument mismatch 3505# check for alloc argument mismatch
3481 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { 3506 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
3482 WARN("ALLOC_ARRAY_ARGS", 3507 WARN("ALLOC_ARRAY_ARGS",
diff --git a/scripts/decodecode b/scripts/decodecode
index 4f8248d5a11f..d8824f37acce 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -89,10 +89,16 @@ echo $code >> $T.s
89disas $T 89disas $T
90cat $T.dis >> $T.aa 90cat $T.dis >> $T.aa
91 91
92# (lines of whole $T.oo) - (lines of $T.aa, i.e. "Code starting") + 3,
93# i.e. the title + the "===..=" line (sed is counting from 1, 0 address is
94# special)
95faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \
96 $(wc -l $T.aa | cut -d" " -f1) + 3))
97
92faultline=`cat $T.dis | head -1 | cut -d":" -f2-` 98faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` 99faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
94 100
95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" 101cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
96echo 102echo
97cat $T.aa 103cat $T.aa
98cleanup 104cleanup
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ce4cc837b748..5e4fb144a04f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -611,7 +611,7 @@ sub get_maintainers {
611 $hash{$tvi} = $value_pd; 611 $hash{$tvi} = $value_pd;
612 } 612 }
613 } 613 }
614 } elsif ($type eq 'K') { 614 } elsif ($type eq 'N') {
615 if ($file =~ m/$value/x) { 615 if ($file =~ m/$value/x) {
616 $hash{$tvi} = 0; 616 $hash{$tvi} = 0;
617 } 617 }
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index b45260bfeaa0..e66d4d258e1a 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -174,5 +174,8 @@ int main(void)
174 DEVID_FIELD(x86_cpu_id, model); 174 DEVID_FIELD(x86_cpu_id, model);
175 DEVID_FIELD(x86_cpu_id, vendor); 175 DEVID_FIELD(x86_cpu_id, vendor);
176 176
177 DEVID(mei_cl_device_id);
178 DEVID_FIELD(mei_cl_device_id, name);
179
177 return 0; 180 return 0;
178} 181}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 771ac17f635d..45f9a3377dcd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1133,6 +1133,18 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1133} 1133}
1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); 1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry);
1135 1135
1136/* Looks like: mei:S */
1137static int do_mei_entry(const char *filename, void *symval,
1138 char *alias)
1139{
1140 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1141
1142 sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name);
1143
1144 return 1;
1145}
1146ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry);
1147
1136/* Does namelen bytes of name exactly match the symbol? */ 1148/* Does namelen bytes of name exactly match the symbol? */
1137static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1149static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1138{ 1150{