Skip to content

Commit

Permalink
Staging: vme: bridges: Add missing unlocks
Browse files Browse the repository at this point in the history
Add a spin_unlock and mutex_unlock missing on the error path.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression E1;
@@

* spin_lock(E1,...);
  <+... when != E1
  if (...) {
    ... when != E1
*   return ...;
  }
  ...+>
* spin_unlock(E1,...);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed Jun 18, 2010
1 parent 45f9f01 commit 7c0ace5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/vme/bridges/vme_ca91cx42.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,8 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
/* Address must be 4-byte aligned */
if (pci_addr & 0x3) {
dev_err(dev, "RMW Address not 4-byte aligned\n");
return -EINVAL;
result = -EINVAL;
goto out;
}

/* Ensure RMW Disabled whilst configuring */
Expand All @@ -921,6 +922,7 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
/* Disable RMW */
iowrite32(0, bridge->base + SCYC_CTL);

out:
spin_unlock(&(image->lock));

mutex_unlock(&(bridge->vme_rmw));
Expand Down

0 comments on commit 7c0ace5

Please sign in to comment.