]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
powerpc/vio: Add missing unlock in error path
authorJulia Lawall <julia@diku.dk>
Mon, 29 Mar 2010 05:33:34 +0000 (05:33 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 7 Apr 2010 08:00:43 +0000 (18:00 +1000)
Add an unlock before exiting the function.

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

// <smpl>
@r exists@
expression E1;
identifier f;
@@

f (...) { <+...
* spin_lock_irq (E1,...);
... when != E1
* return ...;
...+> }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/vio.c

index 2f57956714bd9c2ee2377ca7e948e0c139e2ef37..2a3428bef83a066a8be3dc5874d498691e637031 100644 (file)
@@ -645,8 +645,10 @@ void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired)
                        found = 1;
                        break;
                }
-       if (!found)
+       if (!found) {
+               spin_unlock_irqrestore(&vio_cmo.lock, flags);
                return;
+       }
 
        /* Increase/decrease in desired device entitlement */
        if (desired >= viodev->cmo.desired) {