Commit 86e4754ac8fde9a9c913571016bc31257aa2e195

Authored by Julia Lawall
Committed by Benjamin Herrenschmidt
1 parent f6d8c8bb1d

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
... ... @@ -155,6 +155,7 @@
155 155 while ((in_8(&adb->ctrl.r) & ADB_RST) != 0) {
156 156 if (--timeout == 0) {
157 157 out_8(&adb->ctrl.r, in_8(&adb->ctrl.r) & ~ADB_RST);
  158 + spin_unlock_irqrestore(&macio_lock, flags);
158 159 return -1;
159 160 }
160 161 }
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);