[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1517643898-2801-1-git-send-email-Julia.Lawall@lip6.fr>
Date: Sat, 3 Feb 2018 08:44:58 +0100
From: Julia Lawall <Julia.Lawall@...6.fr>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: kernel-janitors@...r.kernel.org,
Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <michal.lkml@...kovi.net>, cocci@...teme.lip6.fr,
linux-kernel@...r.kernel.org
Subject: [PATCH] coccinelle: deref_null: avoid useless computation
The effect of the rules ifm1, pr11, and pr12 is only used in the final rule,
which depends on context && !org && !report. Thus these rules should only
be performed in those circumstances.
Signed-off-by: Julia Lawall <Julia.Lawall@...6.fr>
---
scripts/coccinelle/null/deref_null.cocci | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci
index f192d60..b16ccb7 100644
--- a/scripts/coccinelle/null/deref_null.cocci
+++ b/scripts/coccinelle/null/deref_null.cocci
@@ -212,7 +212,7 @@ else S3
// The following three rules are duplicates of ifm, pr1 and pr2 respectively.
// It is need because the previous rule as already made a "change".
-@...1@
+@...1 depends on context && !org && !report@
expression *E;
statement S1,S2;
position p1;
@@ -220,7 +220,7 @@ position p1;
if@p1 ((E == NULL && ...) || ...) S1 else S2
-@...1 expression@
+@...1 depends on context && !org && !report expression@
expression *ifm1.E;
identifier f;
position p1;
@@ -228,7 +228,7 @@ position p1;
(E != NULL && ...) ? <+...E->f@.....+> : ...
-@...2 expression@
+@...2 depends on context && !org && !report expression@
expression *ifm1.E;
identifier f;
position p2;
Powered by blists - more mailing lists