diff options
author | Julia Lawall <julia@diku.dk> | 2010-03-29 07:34:46 +0200 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-04-07 10:00:44 +0200 |
commit | 86e4754ac8fde9a9c913571016bc31257aa2e195 (patch) | |
tree | c96a3df8769e488a6a03e40c330e9cacc872045a /drivers/macintosh/smu.c | |
parent | powerpc/vio: Add missing unlock in error path (diff) | |
download | linux-86e4754ac8fde9a9c913571016bc31257aa2e195.tar.xz linux-86e4754ac8fde9a9c913571016bc31257aa2e195.zip |
powerpc/pmac: Add missing unlocks in error path
In some error handling cases the lock is not unlocked.
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_irqsave (E1,...);
... when != E1
* return ...;
...+> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/smu.c')
-rw-r--r-- | drivers/macintosh/smu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 888448cf7f1f..c9da5c4c167d 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c @@ -1183,8 +1183,10 @@ static ssize_t smu_read_command(struct file *file, struct smu_private *pp, return -EOVERFLOW; spin_lock_irqsave(&pp->lock, flags); if (pp->cmd.status == 1) { - if (file->f_flags & O_NONBLOCK) + if (file->f_flags & O_NONBLOCK) { + spin_unlock_irqrestore(&pp->lock, flags); return -EAGAIN; + } add_wait_queue(&pp->wait, &wait); for (;;) { set_current_state(TASK_INTERRUPTIBLE); |