Skip to content

Commit 24febc9

Browse files
Villemoesjic23
authored andcommitted
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: fea251b (iio: addac: add AD74413R driver) Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent a551c26 commit 24febc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/addac/ad74413r.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ static int ad74413r_read_raw(struct iio_dev *indio_dev,
10071007

10081008
ret = ad74413r_get_single_adc_result(indio_dev, chan->channel,
10091009
val);
1010-
if (ret)
1010+
if (ret < 0)
10111011
return ret;
10121012

10131013
ad74413r_adc_to_resistance_result(*val, val);

0 commit comments

Comments
 (0)