* [PATCH] iio: addac: ad74413: fix resistance input processing
@ 2023-05-03 9:58 Rasmus Villemoes
2023-05-04 7:09 ` Nuno Sá
0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2023-05-03 9:58 UTC (permalink / raw)
To: Cosmin Tanislav, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Linus Walleij
Cc: Rasmus Villemoes, Jonathan Cameron, Cosmin Tanislav, linux-iio,
linux-kernel
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>
---
drivers/iio/addac/ad74413r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index 07e9f6ae16a8..e3366cf5eb31 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -1007,7 +1007,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);
--
2.37.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: addac: ad74413: fix resistance input processing
2023-05-03 9:58 [PATCH] iio: addac: ad74413: fix resistance input processing Rasmus Villemoes
@ 2023-05-04 7:09 ` Nuno Sá
0 siblings, 0 replies; 2+ messages in thread
From: Nuno Sá @ 2023-05-04 7:09 UTC (permalink / raw)
To: Rasmus Villemoes, Cosmin Tanislav, Lars-Peter Clausen,
Michael Hennerich, Jonathan Cameron, Linus Walleij
Cc: Jonathan Cameron, Cosmin Tanislav, linux-iio, linux-kernel
On Wed, 2023-05-03 at 11:58 +0200, Rasmus Villemoes wrote:
> 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>
> drivers/iio/addac/ad74413r.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> index 07e9f6ae16a8..e3366cf5eb31 100644
> --- a/drivers/iio/addac/ad74413r.c
> +++ b/drivers/iio/addac/ad74413r.c
> @@ -1007,7 +1007,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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-04 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 9:58 [PATCH] iio: addac: ad74413: fix resistance input processing Rasmus Villemoes
2023-05-04 7:09 ` Nuno Sá
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®