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>
This commit is contained in:
parent
34c895f6e3
commit
dbbe0006d2
1 changed files with 2 additions and 2 deletions
|
@ -707,13 +707,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
|
||||||
ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
|
ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
|
||||||
chan->channel2, val);
|
chan->channel2, val);
|
||||||
mutex_unlock(&st->lock);
|
mutex_unlock(&st->lock);
|
||||||
return IIO_VAL_INT;
|
return ret;
|
||||||
case IIO_ACCEL:
|
case IIO_ACCEL:
|
||||||
mutex_lock(&st->lock);
|
mutex_lock(&st->lock);
|
||||||
ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
|
ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
|
||||||
chan->channel2, val);
|
chan->channel2, val);
|
||||||
mutex_unlock(&st->lock);
|
mutex_unlock(&st->lock);
|
||||||
return IIO_VAL_INT;
|
return ret;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue