mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Andi Kleen <andi@firstfloor.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fix debugfs_simple_attr.cocci warnings (fwd)
Date: Wed, 3 Aug 2016 13:57:37 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1608031356380.2991@hadrien> (raw)

I know nothing about the issues behind this, but I'm forwarding it in case
it's useful.

julia

---------- Forwarded message ----------
Date: Wed, 3 Aug 2016 13:26:56 +0800
From: kbuild test robot <fengguang.wu@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] fix debugfs_simple_attr.cocci warnings

CC: kbuild-all@01.org
In-Reply-To: <1470170405-21530-1-git-send-email-andi@firstfloor.org>
TO: Andi Kleen <andi@firstfloor.org>
CC: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
CC: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>

kernel/panic.c:561:0-23: WARNING: clear_warn_once_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE

 Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
 for debugfs files.

Semantic patch information:
 Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
 imposes some significant overhead as compared to
 DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

CC: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

Please take the patch only if it's a positive warning. Thanks!

 panic.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -558,16 +558,14 @@ static int clear_warn_once_set(void *dat
 	return 0;
 }

-DEFINE_SIMPLE_ATTRIBUTE(clear_warn_once_fops,
-			NULL,
-                        clear_warn_once_set,
-		        "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(clear_warn_once_fops, NULL, clear_warn_once_set,
+			 "%lld\n");

 static __init int register_warn_debugfs(void)
 {
 	/* Don't care about failure */
-	debugfs_create_file("clear_warn_once", 0644, NULL,
-			    NULL, &clear_warn_once_fops);
+	debugfs_create_file_unsafe("clear_warn_once", 0644, NULL, NULL,
+				   &clear_warn_once_fops);
 	return 0;
 }

                 reply	other threads:[~2016-08-03 11:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.10.1608031356380.2991@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®