Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/atm/atmtcp.c: fix error return code

Convert a zero return value on error to a negative one, as returned
elsewhere in the function.

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

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Chas Williams <chas@cmf.nrl.navy.mil>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Julia Lawall and committed by
David S. Miller
e5a98fc2 0a4dd0d7

+1
+1
drivers/atm/atmtcp.c
··· 299 299 out_vcc = find_vcc(dev, ntohs(hdr->vpi), ntohs(hdr->vci)); 300 300 read_unlock(&vcc_sklist_lock); 301 301 if (!out_vcc) { 302 + result = -EUNATCH; 302 303 atomic_inc(&vcc->stats->tx_err); 303 304 goto done; 304 305 }