]> git.kernelconcepts.de Git - mv-sheeva.git/commitdiff
drivers/atm/atmtcp.c: add missing atm_dev_put
authorJulia Lawall <julia@diku.dk>
Wed, 29 Dec 2010 04:01:03 +0000 (04:01 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Dec 2010 20:52:05 +0000 (12:52 -0800)
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>
drivers/atm/atmtcp.c

index 2b464b631f22697ac5f177d371b94d5646683d8f..0b0625054a87a5697c8e4745bfd49eb2d1bf45c0 100644 (file)
@@ -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;