From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760752AbbAaCEV (ORCPT ); Fri, 30 Jan 2015 21:04:21 -0500 Received: from mail-wg0-f42.google.com ([74.125.82.42]:61631 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084AbbAaCET (ORCPT ); Fri, 30 Jan 2015 21:04:19 -0500 Date: Sat, 31 Jan 2015 04:04:14 +0200 From: Heba Aamer To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] checkpatch: enhance check for seq_printf uses that could be seq_puts Message-ID: <20150131020414.GA9833@mohammed-Inspiron-3537> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Heba Aamer --- scripts/checkpatch.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f0bb6d6..0b125ca 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4804,11 +4804,14 @@ 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 !~ /[^\\]\%/) { - if (WARN("PREFER_SEQ_PUTS", - "Prefer seq_puts to seq_printf\n" . $herecurr) && - $fix) { - $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/; + if ($fmt ne "") { + $fmt =~ s/%%//g; + if ($fmt !~ /%/) { + if (WARN("PREFER_SEQ_PUTS", + "Prefer seq_puts to seq_printf\n" . $herecurr) && + $fix) { + $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/; + } } } } -- 1.7.9.5