* [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks
@ 2010-05-26 15:59 Julia Lawall
2010-05-27 7:54 ` Martyn Welch
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-05-26 15:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, devel, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
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>
---
drivers/staging/vme/bridges/vme_ca91cx42.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index 0c82eb4..f38f7b7 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));
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks
2010-05-26 15:59 [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks Julia Lawall
@ 2010-05-27 7:54 ` Martyn Welch
0 siblings, 0 replies; 2+ messages in thread
From: Martyn Welch @ 2010-05-27 7:54 UTC (permalink / raw)
To: Julia Lawall; +Cc: Greg Kroah-Hartman, devel, linux-kernel, kernel-janitors
Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> 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>
>
Good catch.
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
> ---
> drivers/staging/vme/bridges/vme_ca91cx42.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
> index 0c82eb4..f38f7b7 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));
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
>
--
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms | Wales (3828642) at 100
T +44(0)127322748 | Barbirolli Square, Manchester,
E martyn.welch@ge.com | M2 3AB VAT:GB 927559189
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-27 7:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 15:59 [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks Julia Lawall
2010-05-27 7:54 ` Martyn Welch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).