linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw
@ 2012-06-25 13:43 Lars-Peter Clausen
  2012-06-25 15:00 ` Maxime Ripard
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2012-06-25 13:43 UTC (permalink / raw)
  To: Maxime Ripard, Jonathan Cameron; +Cc: linux-iio, Lars-Peter Clausen

This issue was reported by the mini_lock.cocci coccinelle semantic patch.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/adc/at91_adc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 6a08469..f61780a 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -349,9 +349,11 @@ static int at91_adc_read_raw(struct iio_dev *idev,
 						       st->done,
 						       msecs_to_jiffies(1000));
 		if (ret == 0)
-			return -ETIMEDOUT;
-		else if (ret < 0)
+			ret = -ETIMEDOUT;
+		if (ret < 0) {
+			mutex_unlock(&st->lock);
 			return ret;
+		}
 
 		*val = st->last_value;
 
-- 
1.7.10


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

* Re: [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw
  2012-06-25 13:43 [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw Lars-Peter Clausen
@ 2012-06-25 15:00 ` Maxime Ripard
  2012-06-25 20:08   ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2012-06-25 15:00 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Jonathan Cameron, linux-iio

Hi Lars,

You can add my
Acked-By: Maxime Ripard <maxime.ripard@free-electrons.com>

Thanks,
Maxime

Le 25/06/2012 15:43, Lars-Peter Clausen a =E9crit :
> This issue was reported by the mini_lock.cocci coccinelle semantic patc=
h.
>=20
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/iio/adc/at91_adc.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>=20
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 6a08469..f61780a 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -349,9 +349,11 @@ static int at91_adc_read_raw(struct iio_dev *idev,
>  						       st->done,
>  						       msecs_to_jiffies(1000));
>  		if (ret =3D=3D 0)
> -			return -ETIMEDOUT;
> -		else if (ret < 0)
> +			ret =3D -ETIMEDOUT;
> +		if (ret < 0) {
> +			mutex_unlock(&st->lock);
>  			return ret;
> +		}
> =20
>  		*val =3D st->last_value;
> =20


--=20
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw
  2012-06-25 15:00 ` Maxime Ripard
@ 2012-06-25 20:08   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2012-06-25 20:08 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: Lars-Peter Clausen, Jonathan Cameron, linux-iio

On 06/25/2012 04:00 PM, Maxime Ripard wrote:
> Hi Lars,
>=20
> You can add my
> Acked-By: Maxime Ripard <maxime.ripard@free-electrons.com>
>=20
> Thanks,
> Maxime
>=20
> Le 25/06/2012 15:43, Lars-Peter Clausen a =E9crit :
>> This issue was reported by the mini_lock.cocci coccinelle semantic pat=
ch.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
>> ---
>>  drivers/iio/adc/at91_adc.c |    6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
>> index 6a08469..f61780a 100644
>> --- a/drivers/iio/adc/at91_adc.c
>> +++ b/drivers/iio/adc/at91_adc.c
>> @@ -349,9 +349,11 @@ static int at91_adc_read_raw(struct iio_dev *idev=
,
>>  						       st->done,
>>  						       msecs_to_jiffies(1000));
>>  		if (ret =3D=3D 0)
>> -			return -ETIMEDOUT;
>> -		else if (ret < 0)
>> +			ret =3D -ETIMEDOUT;
>> +		if (ret < 0) {
>> +			mutex_unlock(&st->lock);
>>  			return ret;
>> +		}
>> =20
>>  		*val =3D st->last_value;
>> =20
>=20
>=20

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

* [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw
@ 2012-06-26  8:43 Lars-Peter Clausen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2012-06-26  8:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jonathan Cameron, Maxime Ripard, devel, linux-iio,
	Lars-Peter Clausen

This issue was reported by the mini_lock.cocci coccinelle semantic patch.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
 drivers/iio/adc/at91_adc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 6a08469..f61780a 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -349,9 +349,11 @@ static int at91_adc_read_raw(struct iio_dev *idev,
 						       st->done,
 						       msecs_to_jiffies(1000));
 		if (ret == 0)
-			return -ETIMEDOUT;
-		else if (ret < 0)
+			ret = -ETIMEDOUT;
+		if (ret < 0) {
+			mutex_unlock(&st->lock);
 			return ret;
+		}
 
 		*val = st->last_value;
 
-- 
1.7.10


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

end of thread, other threads:[~2012-06-26  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-25 13:43 [PATCH] iio:adc:at91: Relase mutex on error path in at91_adc_read_raw Lars-Peter Clausen
2012-06-25 15:00 ` Maxime Ripard
2012-06-25 20:08   ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2012-06-26  8:43 Lars-Peter Clausen

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