Commit b9556f9a authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/atm/atmtcp.c: add missing atm_dev_put

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: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4d5900a
...@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf) ...@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
atm_dev_put(dev); atm_dev_put(dev);
return -EMEDIUMTYPE; return -EMEDIUMTYPE;
} }
if (PRIV(dev)->vcc) return -EBUSY; if (PRIV(dev)->vcc) {
atm_dev_put(dev);
return -EBUSY;
}
} }
else { else {
int error; int error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment