From 90e6dc7c274dca8a9198e3525488ea991719a799 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 26 Jun 2012 10:43:05 +0200 Subject: 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. Signed-off-by: Lars-Peter Clausen Acked-by: Maxime Ripard Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/at91_adc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/iio/adc/at91_adc.c') diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 6a084695b77..f61780a0237 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; -- cgit v1.2.3-70-g09d2