Skip to content

Commit

Permalink
iio: adc: meson-saradc: unlock on error in meson_sar_adc_lock()
Browse files Browse the repository at this point in the history
The meson_sar_adc_lock() function is not supposed to hold the
"indio_dev->mlock" on the error path.

Fixes: 3adbf34 ("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>
  • Loading branch information
Dan Carpenter authored and Jonathan Cameron committed Mar 10, 2018
1 parent 6de2aeb commit 3c3e4b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iio/adc/meson_saradc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3c3e4b3

Please sign in to comment.