mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable
Add missing return value check in st_lsm6dsx_read_oneshot disabling the sensor. The issue is reported by coverity with the following error: Unchecked return value: If the function returns an error value, the error value may be mistaken for a normal value. Addresses-Coverity-ID: 1446733 ("Unchecked return value") Fixes:b5969abfa8
("iio: imu: st_lsm6dsx: add motion events") Fixes:290a6ce11d
("iio: imu: add support to lsm6dsx driver") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
4766897a9d
commit
a2dd9bd933
1 changed files with 5 additions and 2 deletions
|
@ -1555,8 +1555,11 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (!hw->enable_event)
|
||||
st_lsm6dsx_sensor_set_enable(sensor, false);
|
||||
if (!hw->enable_event) {
|
||||
err = st_lsm6dsx_sensor_set_enable(sensor, false);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
*val = (s16)le16_to_cpu(data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue