Commit 86e4754ac8fde9a9c913571016bc31257aa2e195
Committed by
Benjamin Herrenschmidt
1 parent
f6d8c8bb1d
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 4 additions and 1 deletions Side-by-side Diff
drivers/macintosh/macio-adb.c
drivers/macintosh/smu.c
... | ... | @@ -1183,8 +1183,10 @@ |
1183 | 1183 | return -EOVERFLOW; |
1184 | 1184 | spin_lock_irqsave(&pp->lock, flags); |
1185 | 1185 | if (pp->cmd.status == 1) { |
1186 | - if (file->f_flags & O_NONBLOCK) | |
1186 | + if (file->f_flags & O_NONBLOCK) { | |
1187 | + spin_unlock_irqrestore(&pp->lock, flags); | |
1187 | 1188 | return -EAGAIN; |
1189 | + } | |
1188 | 1190 | add_wait_queue(&pp->wait, &wait); |
1189 | 1191 | for (;;) { |
1190 | 1192 | set_current_state(TASK_INTERRUPTIBLE); |