From: Lorenzo Bianconi Date: Thu, 2 Jan 2020 08:36:29 +0000 (+0100) Subject: iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable X-Git-Tag: v5.6-rc1~138^2~31^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a2dd9bd9334efb8dc0bdc0109abff3a7b57effb1;p=thirdparty%2Flinux.git 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: b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events") Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver") Signed-off-by: Lorenzo Bianconi Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index d205b994a9e09..f3ad5694437ac 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -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);