]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
arch/sh/mm: Eliminate a double lock
authorJulia Lawall <julia@diku.dk>
Sun, 20 Jun 2010 11:24:54 +0000 (11:24 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 21 Jun 2010 04:46:53 +0000 (13:46 +0900)
The function begins and ends with a read_lock.  The latter is changed to a
read_unlock.

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

// <smpl>
@locked@
expression E1;
position p;
@@

read_lock(E1@p,...);

@r exists@
expression x <= locked.E1;
expression locked.E1;
expression E2;
identifier lock;
position locked.p,p1,p2;
@@

*lock@p1 (E1@p,...);
... when != E1
    when != \(x = E2\|&x\)
*lock@p2 (E1,...);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/mm/pmb.c

index 18623ba751b32e3863094bae05bcf44d58141f4b..6379091a164764040c57fce64b9a9dae521bff41 100644 (file)
@@ -770,7 +770,7 @@ static void __init pmb_resize(void)
                spin_unlock_irqrestore(&pmbe->lock, flags);
        }
 
-       read_lock(&pmb_rwlock);
+       read_unlock(&pmb_rwlock);
 }
 #endif