summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-03-08 12:31:53 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-03-10 18:14:14 +0300
commit3c3e4b3a708a9d6451052e348981f37d2b3e92b0 (patch)
tree7546692e603f8d4f6ad7915f2b8f604ca6139ea1 /drivers/iio
parent6de2aeb5746e79b50d2b99bd63f08da880f735a3 (diff)
downloadlinux-3c3e4b3a708a9d6451052e348981f37d2b3e92b0.tar.xz
iio: adc: meson-saradc: unlock on error in meson_sar_adc_lock()
The meson_sar_adc_lock() function is not supposed to hold the "indio_dev->mlock" on the error path. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/meson_saradc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 29fa7736d80c..ede955d9b2a4 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -462,8 +462,10 @@ static int meson_sar_adc_lock(struct iio_dev *indio_dev)
regmap_read(priv->regmap, MESON_SAR_ADC_DELAY, &val);
} while (val & MESON_SAR_ADC_DELAY_BL30_BUSY && timeout--);
- if (timeout < 0)
+ if (timeout < 0) {
+ mutex_unlock(&indio_dev->mlock);
return -ETIMEDOUT;
+ }
}
return 0;