Skip to content

Commit caac1d5

Browse files
heba-aamertorvalds
authored andcommitted
checkpatch: improve seq_print->seq_puts suggestion
Improve the format specifier test by removing any %% before looking for any remaining % format specifier. Signed-off-by: Heba Aamer <heba93aamer@gmail.com> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f8e5821 commit caac1d5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/checkpatch.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4854,7 +4854,8 @@ sub process {
48544854
# check for seq_printf uses that could be seq_puts
48554855
if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
48564856
my $fmt = get_quoted_string($line, $rawline);
4857-
if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
4857+
$fmt =~ s/%%//g;
4858+
if ($fmt !~ /%/) {
48584859
if (WARN("PREFER_SEQ_PUTS",
48594860
"Prefer seq_puts to seq_printf\n" . $herecurr) &&
48604861
$fix) {

0 commit comments

Comments
 (0)