kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] test returned value
@ 2015-04-04 14:59 Julia Lawall
  2015-04-04 14:59 ` [PATCH 1/2] clk: versatile: " Julia Lawall
  2015-04-04 14:59 ` [PATCH 2/2] staging: emxx_udc: " Julia Lawall
  0 siblings, 2 replies; 14+ messages in thread
From: Julia Lawall @ 2015-04-04 14:59 UTC (permalink / raw)
  To: linux-clk; +Cc: kernel-janitors, linux-kernel, devel

Put NULL test on the result of the previous call instead on one of its
arguments.  The complete semantic match that finds these problems is as
follows (http://coccinelle.lip6.fr/):

// <smpl>
@r@
expression *e1;
expression *e2;
identifier f;
statement S1,S2;
position p,p2;
@@

 e1 = f@p(...,e2,...);
(
if (e1 = NULL || ...) S1 else S2
|
if (e1 != NULL || ...) S1 else S2
|
if@p2 (e2 = NULL || ...) S1 else S2
|
if@p2  (e2 != NULL || ...) S1 else S2
)

@ok@
expression e1,e2;
identifier f;
statement S1,S2;
position r.p,r.p2;
@@

 e1 = f@p(...);
(
if@p2 (e2 = NULL || ...) S1 else S2
|
if@p2  (e2 != NULL || ...) S1 else S2
)

@ok1 depends on ok exists@
position r.p;
expression *r.e2;
expression e3;
identifier f,g;
@@

e2->g
... when != e2 = e3
    when != &e2
f@p

@ok2 depends on ok exists@
position r.p;
expression *r.e2;
expression e,e3;
statement S1,S2;
identifier f;
@@

(
if (e2 = NULL || ...) {... return ...;} else S2
|
if (e2 != NULL || ...) S1 else {... return ...;}
)
... when != e2 = e3
    when != &e2
e = f@p(...);

@depends on ok1 || ok2@
expression e1;
identifier f;
position r.p;
@@

* e1 = f@p(...);
// </smpl>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-04-09 15:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-04 14:59 [PATCH 0/2] test returned value Julia Lawall
2015-04-04 14:59 ` [PATCH 1/2] clk: versatile: " Julia Lawall
2015-04-08 18:25   ` Stephen Boyd
2015-04-09  7:30   ` Linus Walleij
2015-04-09 15:23     ` Stephen Boyd
2015-04-04 14:59 ` [PATCH 2/2] staging: emxx_udc: " Julia Lawall
2015-04-04 15:59   ` Dan Carpenter
2015-04-04 16:07     ` Greg Kroah-Hartman
2015-04-04 16:07   ` Greg Kroah-Hartman
2015-04-04 16:20     ` Julia Lawall
2015-04-04 16:54       ` Greg Kroah-Hartman
2015-04-04 17:12       ` Dan Carpenter
2015-04-04 17:21         ` Julia Lawall
2015-04-04 17:31           ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).