From b3b64e2c1575da5f290e75e2a1d9cac307812222 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 23 Mar 2021 13:27:05 +0100 Subject: iio: Fix iio_read_channel_processed_scale() The code was checking if (ret) from the processed channel readout, not smart, we need to check if (ret < 0) as this will likely be something like IIO_VAL_INT. Fixes: 635ef601b238 ("iio: Provide iio_read_channel_processed_scale() API") Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20210323122705.1326362-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron --- drivers/iio/inkern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/iio') diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c61fc06f98b8..9c22697b7e83 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -702,7 +702,7 @@ int iio_read_channel_processed_scale(struct iio_channel *chan, int *val, if (iio_channel_has_info(chan->channel, IIO_CHAN_INFO_PROCESSED)) { ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_PROCESSED); - if (ret) + if (ret < 0) goto err_unlock; *val *= scale; } else { -- cgit 1.4.1