diff options
author | Su Hui <suhui@nfschina.com> | 2023-10-30 10:02:19 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-08 11:27:35 +0100 |
commit | 5212dfdef180209c4c819aaaff7f1c0eab072248 (patch) | |
tree | 6252b045aa21f00d123b1066f90d426d8d9d2a00 | |
parent | d090a235696697e72004d1b8335b289d7597f2b3 (diff) | |
download | linux-stable-5212dfdef180209c4c819aaaff7f1c0eab072248.tar.gz linux-stable-5212dfdef180209c4c819aaaff7f1c0eab072248.tar.bz2 linux-stable-5212dfdef180209c4c819aaaff7f1c0eab072248.zip |
iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw
[ Upstream commit c3df0e29fb7788c4b3ddf37d5ed87dda2b822943 ]
inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
true value rather than only return IIO_VAL_INT.
Fixes: d5098447147c ("iio: imu: mpu6050: add calibration offset support")
Signed-off-by: Su Hui <suhui@nfschina.com>
Link: https://lore.kernel.org/r/20231030020218.65728-1-suhui@nfschina.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 6b560d99f385..351032e4eaad 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -508,13 +508,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev, ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset, chan->channel2, val); mutex_unlock(&st->lock); - return IIO_VAL_INT; + return ret; case IIO_ACCEL: mutex_lock(&st->lock); ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset, chan->channel2, val); mutex_unlock(&st->lock); - return IIO_VAL_INT; + return ret; default: return -EINVAL; |