mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Rashika Kheria <rashika.kheria@gmail.com>
Cc: opw-kernel@googlegroups.com, gregkh@linuxfoundation.org,
	Andy Whitcroft <apw@canonical.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Scripts: checkpatch.pl: Fix incorrect warning in multi-line seq_printf()
Date: Mon, 28 Oct 2013 14:56:01 -0700	[thread overview]
Message-ID: <1382997361.8718.11.camel@joe-AO722> (raw)
In-Reply-To: <1382995962-7023-1-git-send-email-rashika.kheria@gmail.com>

On Tue, 2013-10-29 at 03:02 +0530, Rashika Kheria wrote:
> This patch fixes the following incorrect warning given by checkpatch.pl
> in case of multi-line seq_printf() statements-

I believe this is already fixed in -next

>From 7f1b7c2810888bba02311ec75b19e0cbd598ef83 Mon Sep 17 00:00:00 2001
From: Joe Perches <joe@perches.com>
Date: Fri, 27 Sep 2013 10:14:51 +1000
Subject: [PATCH] checkpatch: update seq_<foo> tests

seq_vprintf, seq_printf and seq_puts are logging functions and should be
allowed to exceed the maximium line length.

Add maximum line length exceptions for these functions.

Also, suggesting seq_printf conversions to seq_puts should be tested for
arguments after the format.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
 scripts/checkpatch.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c03e427..42567bc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -323,7 +323,8 @@ our $logFunctions = qr{(?x:
 	(?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
 	WARN(?:_RATELIMIT|_ONCE|)|
 	panic|
-	MODULE_[A-Z_]+
+	MODULE_[A-Z_]+|
+	seq_vprintf|seq_printf|seq_puts
 )};
 
 our $signature_tags = qr{(?xi:
@@ -3909,9 +3910,9 @@ sub string_find_replace {
 		}
 
 # check for seq_printf uses that could be seq_puts
-		if ($line =~ /\bseq_printf\s*\(/) {
+		if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
 			my $fmt = get_quoted_string($line, $rawline);
-			if ($fmt !~ /[^\\]\%/) {
+			if ($fmt ne "" && $fmt !~ /[^\\]\%/) {
 				if (WARN("PREFER_SEQ_PUTS",
 					 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
 				    $fix) {



      reply	other threads:[~2013-10-28 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 21:32 Rashika Kheria
2013-10-28 21:56 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382997361.8718.11.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opw-kernel@googlegroups.com \
    --cc=rashika.kheria@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®