coccinelle: deref_null: avoid useless computation

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/a2b0fe7435faee6f6fbb27409878013bc4727e98
Commit:     a2b0fe7435faee6f6fbb27409878013bc4727e98
Parent:     e856f3a7d706b37d8be9b41e41b19f4919570e57
Refname:    refs/heads/master
Author:     Julia Lawall <[email protected]>
AuthorDate: Sat Feb 3 08:44:58 2018 +0100
Committer:  Masahiro Yamada <[email protected]>
CommitDate: Thu Feb 8 00:16:12 2018 +0900

    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 <[email protected]>
    Signed-off-by: Masahiro Yamada <[email protected]>
---
 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 f192d6035d02..b16ccb7663a7 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".
 
-@ifm1@
+@ifm1 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
 
-@pr11 expression@
+@pr11 depends on context && !org && !report expression@
 expression *ifm1.E;
 identifier f;
 position p1;
@@ -228,7 +228,7 @@ position p1;
 
  (E != NULL && ...) ? <+...E->f@p1...+> : ...
 
-@pr12 expression@
+@pr12 depends on context && !org && !report expression@
 expression *ifm1.E;
 identifier f;
 position p2;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.