drivers/net/ax88796.c: Return error code in failure
authorJulia Lawall <julia@diku.dk>
Mon, 18 Oct 2010 04:11:14 +0000 (04:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Oct 2010 11:25:50 +0000 (04:25 -0700)
In this code, 0 is returned on failure, even though other
failures return -ENOMEM or other similar values.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@a@
identifier alloc;
identifier ret;
constant C;
expression x;
@@

x = alloc(...);
if (x == NULL) { <+... \(ret = -C; \| return -C; \) ...+> }

@@
identifier f, a.alloc;
expression ret;
expression x,e1,e2,e3;
@@

ret = 0
... when != ret = e1
*x = alloc(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>

No differences found