All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martyn Welch <martyn.welch@ge.com>
To: Julia Lawall <julia@diku.dk>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks
Date: Thu, 27 May 2010 07:54:49 +0000	[thread overview]
Message-ID: <4BFE2549.4000403@ge.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005261758540.23743@ask.diku.dk>

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


WARNING: multiple messages have this Message-ID (diff)
From: Martyn Welch <martyn.welch@ge.com>
To: Julia Lawall <julia@diku.dk>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks
Date: Thu, 27 May 2010 08:54:49 +0100	[thread overview]
Message-ID: <4BFE2549.4000403@ge.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005261758540.23743@ask.diku.dk>

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


  reply	other threads:[~2010-05-27  7:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 15:59 [PATCH 16/17] drivers/staging/vme/bridges: Add missing unlocks Julia Lawall
2010-05-26 15:59 ` Julia Lawall
2010-05-27  7:54 ` Martyn Welch [this message]
2010-05-27  7:54   ` Martyn Welch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BFE2549.4000403@ge.com \
    --to=martyn.welch@ge.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.