Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365668
b: refs/heads/master
c: a6962d7
h: refs/heads/master
v: v3
  • Loading branch information
Joe Perches authored and Linus Torvalds committed Apr 30, 2013
1 parent 7a4fad1 commit 0584079
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 972fdea2e6ece7578915d386a5447bc78d3fb8b8
refs/heads/master: a6962d7273d8f89c136fe9ea3d61d7f47adcd823
16 changes: 16 additions & 0 deletions trunk/scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,13 @@ sub sanitise_line {
return $res;
}

sub get_quoted_string {
my ($line, $rawline) = @_;

return "" if ($line !~ m/(\"[X]+\")/g);
return substr($rawline, $-[0], $+[0] - $-[0]);
}

sub ctx_statement_block {
my ($linenr, $remain, $off) = @_;
my $line = $linenr - 1;
Expand Down Expand Up @@ -3373,6 +3380,15 @@ sub process {
"struct spinlock should be spinlock_t\n" . $herecurr);
}

# check for seq_printf uses that could be seq_puts
if ($line =~ /\bseq_printf\s*\(/) {
my $fmt = get_quoted_string($line, $rawline);
if ($fmt !~ /[^\\]\%/) {
WARN("PREFER_SEQ_PUTS",
"Prefer seq_puts to seq_printf\n" . $herecurr);
}
}

# Check for misused memsets
if ($^V && $^V ge 5.10.0 &&
defined $stat &&
Expand Down

0 comments on commit 0584079

Please sign in to comment.