Skip to content

Commit

Permalink
iio: accel: adxl380: fix raw sample read
Browse files Browse the repository at this point in the history
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.

Link: https://lore.kernel.org/lkml/20241101095202.20121-1-antoniu.miclaus@analog.com/
Fixes: 90a7580 ("iio: accel: add ADXL380 driver")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
  • Loading branch information
amiclaus authored and nunojsa committed Nov 5, 2024
1 parent 7c9195b commit 54eb23f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/accel/adxl380.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ static int adxl380_read_raw(struct iio_dev *indio_dev,
return ret;

ret = adxl380_read_chn(st, chan->address);
if (ret)
if (ret < 0)
return ret;

iio_device_release_direct_mode(indio_dev);
Expand Down

0 comments on commit 54eb23f

Please sign in to comment.