Skip to contentSkip to conversation

checkpatch: enhance check for seq_printf uses that could be seq_puts

PATCH New Heba Aamer 1 participant 1 message Jan 31, 2015 Checkpatch

lore
Share & tools
lore

Heba Aamer

author
#0 lore raw

PATCH v2 1/1 checkpatch: enhance check for seq_printf uses that could be seq_puts

This patch enhances the check for seq_printf uses that could be seq_puts.

It was considering the escape of % is \%, but it is %%. This led to skipping some valid cases related to that warning.

---
v2: remove not needed if condition

 scripts/checkpatch.pl |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +2 -1
index f0bb6d6..e3ebfe6 100755
@@ -4804,7 +4804,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) {
Signature · 1 line
1.7.9.5