checkpatch: improve seq_print->seq_puts suggestion
authorHeba Aamer <[email protected]>
Fri, 13 Feb 2015 22:38:49 +0000 (14:38 -0800)
committerLinus Torvalds <[email protected]>
Sat, 14 Feb 2015 05:21:40 +0000 (21:21 -0800)
Improve the format specifier test by removing any %% before looking for
any remaining % format specifier.

Signed-off-by: Heba Aamer <[email protected]>
Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
scripts/checkpatch.pl

index 059c032d8882c12fff84de65a505ae525e1d45d4..7f1804e052f2b4ba1f05fec697a14576d544187b 100755 (executable)
@@ -4854,7 +4854,8 @@ sub process {
 # check for seq_printf uses that could be seq_puts
                if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
                        my $fmt = get_quoted_string($line, $rawline);
-                       if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
+                       $fmt =~ s/%%//g;
+                       if ($fmt !~ /%/) {
                                if (WARN("PREFER_SEQ_PUTS",
                                         "Prefer seq_puts to seq_printf\n" . $herecurr) &&
                                    $fix) {