Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw

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>

authored by

Su Hui and committed by
Jonathan Cameron
c3df0e29 1cd2fe4f

+2 -2
+2 -2
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
··· 750 750 ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset, 751 751 chan->channel2, val); 752 752 mutex_unlock(&st->lock); 753 - return IIO_VAL_INT; 753 + return ret; 754 754 case IIO_ACCEL: 755 755 mutex_lock(&st->lock); 756 756 ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset, 757 757 chan->channel2, val); 758 758 mutex_unlock(&st->lock); 759 - return IIO_VAL_INT; 759 + return ret; 760 760 761 761 default: 762 762 return -EINVAL;