aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 22:47:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 22:47:50 -0400
commit56847d857cb0c3ee78c22ce776a26f88d9ffd4d4 (patch)
treea85bcf204a53e45d26f6a3984f16ddd525eef3e7 /scripts
parent191a712090bb8a10e6f129360eeed2d68f3d4c9a (diff)
parent8d564368a9a3197f43e56dadf4a18c5738849f94 (diff)
Merge branch 'akpm' (incoming from Andrew)
Merge second batch of fixes from Andrew Morton: - various misc bits - some printk updates - a new "SRAM" driver. - MAINTAINERS updates - the backlight driver queue - checkpatch updates - a few init/ changes - a huge number of drivers/rtc changes - fatfs updates - some lib/idr.c work - some renaming of the random driver interfaces * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (285 commits) net: rename random32 to prandom net/core: remove duplicate statements by do-while loop net/core: rename random32() to prandom_u32() net/netfilter: rename random32() to prandom_u32() net/sched: rename random32() to prandom_u32() net/sunrpc: rename random32() to prandom_u32() scsi: rename random32() to prandom_u32() lguest: rename random32() to prandom_u32() uwb: rename random32() to prandom_u32() video/uvesafb: rename random32() to prandom_u32() mmc: rename random32() to prandom_u32() drbd: rename random32() to prandom_u32() kernel/: rename random32() to prandom_u32() mm/: rename random32() to prandom_u32() lib/: rename random32() to prandom_u32() x86: rename random32() to prandom_u32() x86: pageattr-test: remove srandom32 call uuid: use prandom_bytes() raid6test: use prandom_bytes() sctp: convert sctp_assoc_set_id() to use idr_alloc_cyclic() ...
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl33
-rwxr-xr-xscripts/get_maintainer.pl2
2 files changed, 30 insertions, 5 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/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 }