public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: iio: light: isl29018: Add missing mutex_unlock on error path
@ 2015-04-28 17:09 Roberta Dobrescu
  2015-04-30 20:56 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Roberta Dobrescu @ 2015-04-28 17:09 UTC (permalink / raw)
  To: linux-iio
  Cc: jic23, knaack.h, lars, pmeerw, daniel.baluta, dan.carpenter,
	kbuild, Roberta Dobrescu

This patch fixes the following warning:

drivers/staging/iio/light/isl29018.c:386 isl29018_write_raw() warn:
inconsistent returns 'mutex:&chip->lock'.
 Locked on:   line 374
 Unlocked on: line 386

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/staging/iio/light/isl29018.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
index 435d417..08ca9a4 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -370,8 +370,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
 		break;
 	case IIO_CHAN_INFO_INT_TIME:
 		if (chan->type == IIO_LIGHT)
-			if (val != 0)
+			if (val != 0) {
+				mutex_unlock(&chip->lock);
 				return -EINVAL;
+			}
 			ret = isl29018_set_integration_time(chip, val2);
 		break;
 	case IIO_CHAN_INFO_SCALE:
-- 
1.9.1

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

* Re: [PATCH] staging: iio: light: isl29018: Add missing mutex_unlock on error path
  2015-04-28 17:09 [PATCH] staging: iio: light: isl29018: Add missing mutex_unlock on error path Roberta Dobrescu
@ 2015-04-30 20:56 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2015-04-30 20:56 UTC (permalink / raw)
  To: Roberta Dobrescu, linux-iio
  Cc: knaack.h, lars, pmeerw, daniel.baluta, dan.carpenter, kbuild

On 28/04/15 18:09, Roberta Dobrescu wrote:
> This patch fixes the following warning:
> 
> drivers/staging/iio/light/isl29018.c:386 isl29018_write_raw() warn:
> inconsistent returns 'mutex:&chip->lock'.
>  Locked on:   line 374
>  Unlocked on: line 386
> 
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
I applied this as a fixup rather than a separate patch.

Anyhow, new testing and togreg branches should have this fixed.
> ---
>  drivers/staging/iio/light/isl29018.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
> index 435d417..08ca9a4 100644
> --- a/drivers/staging/iio/light/isl29018.c
> +++ b/drivers/staging/iio/light/isl29018.c
> @@ -370,8 +370,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
>  		break;
>  	case IIO_CHAN_INFO_INT_TIME:
>  		if (chan->type == IIO_LIGHT)
> -			if (val != 0)
> +			if (val != 0) {
> +				mutex_unlock(&chip->lock);
>  				return -EINVAL;
> +			}
>  			ret = isl29018_set_integration_time(chip, val2);
>  		break;
>  	case IIO_CHAN_INFO_SCALE:
> 


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

end of thread, other threads:[~2015-04-30 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28 17:09 [PATCH] staging: iio: light: isl29018: Add missing mutex_unlock on error path Roberta Dobrescu
2015-04-30 20:56 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox