Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: addac: ad74413: fix resistance input processing

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>

authored by

Rasmus Villemoes and committed by
Jonathan Cameron
24febc99 a551c26e

+1 -1
+1 -1
drivers/iio/addac/ad74413r.c
··· 1007 1007 1008 1008 ret = ad74413r_get_single_adc_result(indio_dev, chan->channel, 1009 1009 val); 1010 - if (ret) 1010 + if (ret < 0) 1011 1011 return ret; 1012 1012 1013 1013 ad74413r_adc_to_resistance_result(*val, val);