aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a820249a3fce..b8b03aa52beb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -628,6 +628,13 @@ sub sanitise_line {
628 return $res; 628 return $res;
629} 629}
630 630
631sub get_quoted_string {
632 my ($line, $rawline) = @_;
633
634 return "" if ($line !~ m/(\"[X]+\")/g);
635 return substr($rawline, $-[0], $+[0] - $-[0]);
636}
637
631sub ctx_statement_block { 638sub ctx_statement_block {
632 my ($linenr, $remain, $off) = @_; 639 my ($linenr, $remain, $off) = @_;
633 my $line = $linenr - 1; 640 my $line = $linenr - 1;
@@ -3373,6 +3380,15 @@ sub process {
3373 "struct spinlock should be spinlock_t\n" . $herecurr); 3380 "struct spinlock should be spinlock_t\n" . $herecurr);
3374 } 3381 }
3375 3382
3383# check for seq_printf uses that could be seq_puts
3384 if ($line =~ /\bseq_printf\s*\(/) {
3385 my $fmt = get_quoted_string($line, $rawline);
3386 if ($fmt !~ /[^\\]\%/) {
3387 WARN("PREFER_SEQ_PUTS",
3388 "Prefer seq_puts to seq_printf\n" . $herecurr);
3389 }
3390 }
3391
3376# Check for misused memsets 3392# Check for misused memsets
3377 if ($^V && $^V ge 5.10.0 && 3393 if ($^V && $^V ge 5.10.0 &&
3378 defined $stat && 3394 defined $stat &&