The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Meyer <thomas@m3y3r.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Julia Lawall <julia@diku.dk>
Subject: [PATCH] check for get/put_cpu() imbalances
Date: Sun, 21 Aug 2011 14:12:54 +0200	[thread overview]
Message-ID: <1313928777.18505.2.camel@localhost.localdomain> (raw)

From: Thomas Meyer <thomas@m3y3r.de>

Semantic patch that checks if every get_cpu() has a corresponding put_cpu().

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 scripts/coccinelle/misc/getput_cpu.cocci |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
 create mode 100644 scripts/coccinelle/misc/getput_cpu.cocci

diff --git a/scripts/coccinelle/misc/getput_cpu.cocci b/scripts/coccinelle/misc/getput_cpu.cocci
new file mode 100644
index 0000000..8f76153
--- /dev/null
+++ b/scripts/coccinelle/misc/getput_cpu.cocci
@@ -0,0 +1,24 @@
+/// Check for get/put_cpu() imbalances
+///
+// Confidence: Low
+// Copyright: (C) 2011 Thomas Meyer
+// URL:
+// Comments:
+// Options: -no_includes -include_headers
+
+virtual report
+
+@r1 depends on report@
+position p;
+@@
+
+* get_cpu()@p
+... when != put_cpu()
+? get_cpu()
+
+@script:python depends on report@
+p << r1.p;
+@@
+
+msg="WARNING: Possible missing put_cpu()!"
+coccilib.report.print_report(p[0], msg)
-- 
1.7.6



                 reply	other threads:[~2011-08-21 12:13 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=1313928777.18505.2.camel@localhost.localdomain \
    --to=thomas@m3y3r.de \
    --cc=julia@diku.dk \
    --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