diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2023-05-03 12:58:17 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-09 11:34:19 +0300 |
commit | 84f4d63ae184cfeecce8dda16b5dd4258760d469 (patch) | |
tree | f66297469f6f373d561e293a766788e4875e2f16 | |
parent | ab0c2dffe80f2ec63b3c43f2930f7a6b536d687b (diff) | |
download | linux-84f4d63ae184cfeecce8dda16b5dd4258760d469.tar.xz |
iio: addac: ad74413: fix resistance input processing
commit 24febc99ca725dcf42d57168a2f4e8a75a5ade92 upstream.
On success, ad74413r_get_single_adc_result() returns IIO_VAL_INT aka
1. So currently, the IIO_CHAN_INFO_PROCESSED case is effectively
equivalent to the IIO_CHAN_INFO_RAW case, and we never call
ad74413r_adc_to_resistance_result() to convert the adc measurement to
ohms.
Check ret for being negative rather than non-zero.
Fixes: fea251b6a5dbd (iio: addac: add AD74413R driver)
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230503095817.452551-1-linux@rasmusvillemoes.dk
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/iio/addac/ad74413r.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index e0e130ba9d3e..05faf3910bfc 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -973,7 +973,7 @@ static int ad74413r_read_raw(struct iio_dev *indio_dev, ret = ad74413r_get_single_adc_result(indio_dev, chan->channel, val); - if (ret) + if (ret < 0) return ret; ad74413r_adc_to_resistance_result(*val, val); |