diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-05-30 16:35:27 +0530 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-06-03 09:55:25 +0100 |
commit | 42d97ac6a8384197f5b2745592c55aae3191b0e0 (patch) | |
tree | 2ba2820fb544948c2f023cb99767a63d72fb76a0 /drivers/iio/adc | |
parent | f4f93bf77dc14e99b2bd383bd67e30294e732372 (diff) |
iio:adc:lpc32xx Handle return value of clk_prepare_enable
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/lpc32xx_adc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c index 0de709b4288b..6a5b9a9bc662 100644 --- a/drivers/iio/adc/lpc32xx_adc.c +++ b/drivers/iio/adc/lpc32xx_adc.c @@ -76,10 +76,14 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, long mask) { struct lpc32xx_adc_state *st = iio_priv(indio_dev); - + int ret; if (mask == IIO_CHAN_INFO_RAW) { mutex_lock(&indio_dev->mlock); - clk_prepare_enable(st->clk); + ret = clk_prepare_enable(st->clk); + if (ret) { + mutex_unlock(&indio_dev->mlock); + return ret; + } /* Measurement setup */ __raw_writel(LPC32XXAD_INTERNAL | (chan->address) | LPC32XXAD_REFp | LPC32XXAD_REFm, |