linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] iio: double unlock on error path
@ 2012-07-11  6:34 Dan Carpenter
  2012-07-12 19:24 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-07-11  6:34 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, kernel-janitors

We should be holding the mutex when we goto error_free_chans.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index e2aded0..b5afc2f 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name)
 		iio_device_get(chans[mapind].indio_dev);
 		mapind++;
 	}
-	mutex_unlock(&iio_map_list_lock);
 	if (mapind == 0) {
 		ret = -ENODEV;
 		goto error_free_chans;
 	}
+	mutex_unlock(&iio_map_list_lock);
+
 	return chans;
 
 error_free_chans:

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] iio: double unlock on error path
  2012-07-11  6:34 [patch] iio: double unlock on error path Dan Carpenter
@ 2012-07-12 19:24 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2012-07-12 19:24 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-iio, kernel-janitors

On 07/11/2012 07:34 AM, Dan Carpenter wrote:
> We should be holding the mutex when we goto error_free_chans.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
merged to fixes-togreg branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

and pull request sent.  Thanks.
> 
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index e2aded0..b5afc2f 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name)
>  		iio_device_get(chans[mapind].indio_dev);
>  		mapind++;
>  	}
> -	mutex_unlock(&iio_map_list_lock);
>  	if (mapind == 0) {
>  		ret = -ENODEV;
>  		goto error_free_chans;
>  	}
> +	mutex_unlock(&iio_map_list_lock);
> +
>  	return chans;
>  
>  error_free_chans:
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-12 19:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-11  6:34 [patch] iio: double unlock on error path Dan Carpenter
2012-07-12 19:24 ` Jonathan Cameron

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).