Skip to content

Commit

Permalink
arch/sh/mm: Eliminate a double lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Paul Mundt committed Jun 21, 2010
1 parent 9973e38 commit 0e6f989
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sh/mm/pmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0e6f989

Please sign in to comment.