checkpatch: improve seq_print->seq_puts suggestion
authorHeba Aamer <heba93aamer@gmail.com>
Fri, 13 Feb 2015 22:38:49 +0000 (14:38 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
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 <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>
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) {