Skip to content

Commit bfa335f

Browse files
amiclausjic23
authored andcommitted
iio: accel: adxl380: fix raw sample read
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: df36de1 ("iio: accel: add ADXL380 driver") Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://patch.msgid.link/20241101095202.20121-1-antoniu.miclaus@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent b7d2bc9 commit bfa335f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iio/accel/adxl380.c

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

11821182
ret = adxl380_read_chn(st, chan->address);
11831183
iio_device_release_direct_mode(indio_dev);
1184-
if (ret)
1184+
if (ret < 0)
11851185
return ret;
11861186

11871187
*val = sign_extend32(ret >> chan->scan_type.shift,

0 commit comments

Comments
 (0)