Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e63ed6b authored by Tomer Maimon's avatar Tomer Maimon Committed by Jonathan Cameron
Browse files

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: default avatarTomer Maimon <tmaimon77@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 131ac622
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {