From 7c0ace54887872ebd99fefdfe85d273295a09426 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 26 May 2010 17:59:11 +0200 Subject: [PATCH 093/524] Staging: vme: bridges: Add missing unlocks 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/) // @@ expression E1; @@ * spin_lock(E1,...); <+... when != E1 if (...) { ... when != E1 * return ...; } ...+> * spin_unlock(E1,...); // Signed-off-by: Julia Lawall Signed-off-by: Martyn Welch Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme/bridges/vme_ca91cx42.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index 0f9ea58..16cf53e 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -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 */ @@ -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)); -- 1.7.1