From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754994AbbAaWib (ORCPT ); Sat, 31 Jan 2015 17:38:31 -0500 Received: from mail-we0-f170.google.com ([74.125.82.170]:45506 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752164AbbAaWi3 (ORCPT ); Sat, 31 Jan 2015 17:38:29 -0500 Date: Sun, 1 Feb 2015 00:38:25 +0200 From: Heba Aamer To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2] checkpatch: enhance check for seq_printf uses that could be seq_puts Message-ID: <20150131223825.GA5314@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 --- v2: remove not needed if condition scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f0bb6d6..e3ebfe6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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) { -- 1.7.9.5