All of lore.kernel.org
 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
* [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 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.