Skip to content

Commit

Permalink
powerpc/vio: Add missing unlock in error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Benjamin Herrenschmidt committed Apr 7, 2010
1 parent 43caa61 commit f6d8c8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f6d8c8b

Please sign in to comment.