mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
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>
This commit is contained in:
parent
f8e58219dc
commit
caac1d5fdd
@ -4854,7 +4854,8 @@ sub process {
|
|||||||
# check for seq_printf uses that could be seq_puts
|
# check for seq_printf uses that could be seq_puts
|
||||||
if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
|
if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
|
||||||
my $fmt = get_quoted_string($line, $rawline);
|
my $fmt = get_quoted_string($line, $rawline);
|
||||||
if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
|
$fmt =~ s/%%//g;
|
||||||
|
if ($fmt !~ /%/) {
|
||||||
if (WARN("PREFER_SEQ_PUTS",
|
if (WARN("PREFER_SEQ_PUTS",
|
||||||
"Prefer seq_puts to seq_printf\n" . $herecurr) &&
|
"Prefer seq_puts to seq_printf\n" . $herecurr) &&
|
||||||
$fix) {
|
$fix) {
|
||||||
|
Loading…
Reference in New Issue
Block a user