[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241101152423.7d3f4c94@jic23-huawei>
Date: Fri, 1 Nov 2024 15:24:23 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Michael Hennerich
<Michael.Hennerich@...log.com>, Ramona Gradinariu
<ramona.gradinariu@...log.com>, <linux-iio@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: accel: adxl380: fix raw sample read
On Fri, 1 Nov 2024 11:52:01 +0200
Antoniu Miclaus <antoniu.miclaus@...log.com> wrote:
> The adxl380_read_chn function returns either a negative value in case an
> error occurs or the actual sample.
>
> Check only for negative values after a channel is read.
>
> Fixes: df36de13677a ("iio: accel: add ADXL380 driver")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
ouch. Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
> ---
> drivers/iio/accel/adxl380.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/adxl380.c b/drivers/iio/accel/adxl380.c
> index f80527d899be..b19ee37df7f1 100644
> --- a/drivers/iio/accel/adxl380.c
> +++ b/drivers/iio/accel/adxl380.c
> @@ -1181,7 +1181,7 @@ static int adxl380_read_raw(struct iio_dev *indio_dev,
>
> ret = adxl380_read_chn(st, chan->address);
> iio_device_release_direct_mode(indio_dev);
> - if (ret)
> + if (ret < 0)
> return ret;
>
> *val = sign_extend32(ret >> chan->scan_type.shift,
Powered by blists - more mailing lists