public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Lambert <lambert.quentin@gmail.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Michal Marek <mmarek@suse.cz>
Cc: linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr
Subject: [PATCH 1/1] coccinelle: misc: Semantic patch to find attempts at comparing struct clk pointers
Date: Fri, 6 Feb 2015 10:34:50 +0100	[thread overview]
Message-ID: <20150206093450.GA1617@sloth> (raw)

This semantic patches find instances where struct clk pointers are compared.

This was proposed by Stephen Boyd.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---

 This patch was discussed in this thread:
 https://lkml.org/lkml/2015/2/2/629

 scripts/coccinelle/misc/structclk.cocci | 44 +++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 scripts/coccinelle/misc/structclk.cocci

diff --git a/scripts/coccinelle/misc/structclk.cocci b/scripts/coccinelle/misc/structclk.cocci
new file mode 100644
index 0000000..0307d34
--- /dev/null
+++ b/scripts/coccinelle/misc/structclk.cocci
@@ -0,0 +1,44 @@
+/// Find any attempt to compare struct clk pointers.
+///
+// Confidence: High
+// Copyright: (C) 2015 Quentin Lambert, INRIA/LiP6. GPLv2
+// URL: http://coccinelle.lip6.fr/
+// Options: --recursive-includes --relax-include-path
+// Options: --include-headers-for-types
+
+virtual context
+virtual org
+virtual report
+
+
+// ----------------------------------------------------------------------------
+
+@comparison depends on context || org || report@
+struct clk *x1, x2;
+position j0;
+@@
+
+(
+*  x1@j0 == x2
+|
+*  x1@j0 != x2
+)
+
+// ----------------------------------------------------------------------------
+
+@script:python comparison_org depends on org@
+j0 << comparison.j0;
+@@
+
+msg = "WARNING trying to compare struct clk pointers."
+coccilib.org.print_todo(j0[0], msg)
+
+// ----------------------------------------------------------------------------
+
+@script:python comparison_report depends on report@
+j0 << comparison.j0;
+@@
+
+msg = "WARNING trying to compare struct clk pointers."
+coccilib.report.print_report(j0[0], msg)
+
-- 
1.9.1


                 reply	other threads:[~2015-02-06  9:34 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=20150206093450.GA1617@sloth \
    --to=lambert.quentin@gmail.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=nicolas.palix@imag.fr \
    /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