Skip to content

Commit

Permalink
IB/ehca: Release mutex in error path of alloc_small_queue_page()
Browse files Browse the repository at this point in the history
The pd->lock mutex is released on a successful return, so it should be
released on an error return as well.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression l;
@@

mutex_lock(l);
... when != mutex_unlock(l)
    when any
    when strict
(
if (...) { ... when != mutex_unlock(l)
+   mutex_unlock(l);
    return ...;
}
|
mutex_unlock(l);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Julia Lawall authored and Roland Dreier committed Jul 22, 2008
1 parent 593e4d4 commit 1a867c3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/infiniband/hw/ehca/ipz_pt_fn.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ static int alloc_small_queue_page(struct ipz_queue *queue, struct ehca_pd *pd)

out:
ehca_err(pd->ib_pd.device, "failed to allocate small queue page");
mutex_unlock(&pd->lock);
return 0;
}

Expand Down

0 comments on commit 1a867c3

Please sign in to comment.