Skip to content

Commit

Permalink
drivers/atm/atmtcp.c: add missing atm_dev_put
Browse files Browse the repository at this point in the history
The earlier call to atm_dev_lookup increases the reference count of dev,
so decrease it on the way out.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x, E;
constant C;
@@

x = atm_dev_lookup(...);
... when != false x != NULL
    when != true x == NULL
    when != \(E = x\|x = E\)
    when != atm_dev_put(dev);
*return -C;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Julia Lawall authored and David S. Miller committed Dec 31, 2010
1 parent f4d5900 commit b9556f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/atm/atmtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
atm_dev_put(dev);
return -EMEDIUMTYPE;
}
if (PRIV(dev)->vcc) return -EBUSY;
if (PRIV(dev)->vcc) {
atm_dev_put(dev);
return -EBUSY;
}
}
else {
int error;
Expand Down

0 comments on commit b9556f9

Please sign in to comment.