Skip to contentSkip to conversation

iio:adc:at91: Relase mutex on error path in at91_adc_read_raw

PATCH New Lars-Peter Clausen 1 participant 1 message Jun 26, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio:adc:at91: Relase mutex on error path in at91_adc_read_raw

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

---
 drivers/iio/adc/at91_adc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/adc/at91_adc.c +4 -2
index 6a08469..f61780a 100644
@@ -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;
 
Signature · 1 line
1.7.10