aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorTomer Maimon <tmaimon77@gmail.com>2019-04-07 11:19:28 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-04-07 11:26:47 +0100
commit4e63ed6b90803eeb400c392e9ff493200d926b06 (patch)
tree80cb05024960d2ff83fecb56ccdfd27dab5e01bf /drivers/iio/adc
parentstaging: most: core: use device description as name (diff)
downloadlinux-dev-4e63ed6b90803eeb400c392e9ff493200d926b06.tar.xz
linux-dev-4e63ed6b90803eeb400c392e9ff493200d926b06.zip
iio: adc: modify NPCM ADC read reference voltage
Checking if regulator is valid before reading NPCM ADC regulator voltage to avoid system crash in a case the regulator is not valid. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/npcm_adc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c
index 9e25bbec9c70..193b3b81de4d 100644
--- a/drivers/iio/adc/npcm_adc.c
+++ b/drivers/iio/adc/npcm_adc.c
@@ -149,7 +149,7 @@ static int npcm_adc_read_raw(struct iio_dev *indio_dev,
}
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
- if (info->vref) {
+ if (!IS_ERR(info->vref)) {
vref_uv = regulator_get_voltage(info->vref);
*val = vref_uv / 1000;
} else {