All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] iio: adc: modify NPCM ADC read reference voltage
@ 2019-04-07  8:19 Tomer Maimon
  2019-04-07 10:28 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Tomer Maimon @ 2019-04-07  8:19 UTC (permalink / raw)
  To: gregkh, jic23, knaack.h, lars, pmeerw, yuenn, venture,
	brendanhiggins, avifishman70, joel
  Cc: linux-iio, openbmc, linux-kernel, Tomer Maimon

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>
---
 drivers/iio/adc/npcm_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 {
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-07 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-07  8:19 [PATCH v1] iio: adc: modify NPCM ADC read reference voltage Tomer Maimon
2019-04-07 10:28 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.