Skip to contentSkip to conversation

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

PATCH Applied Su Hui 2 participants 2 messages Oct 30, 2023 – Nov 26, 2023

Subsystems (3)
lore
Share & tools
lore

Su Hui

author
#0 lore raw

PATCH v3 1/1 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")

---
v3:
- add Fixes tag
v2:
- fix the error of commit title.
v1:
- https://lore.kernel.org/all/[email protected]/

 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -2
index 29f906c884bd..a9a5fb266ef1 100644
@@ -749,13 +749,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;
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 5 lines · On Mon, 30 Oct 2023 10:02:19 +0800 Su Hui <[email protected]> wrote:

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")

Applied to the fixes-togreg branch of iio.git.

It's independent enough from the improved error reporting that they can hopefully got through different branches.

Thanks,

Jonathan

Quoted 31 lines

---
v3:
- add Fixes tag
v2:
- fix the error of commit title.
v1:
- https://lore.kernel.org/all/[email protected]/

 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +2 -2
index 29f906c884bd..a9a5fb266ef1 100644
@@ -749,13 +749,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;