Skip to contentSkip to conversation

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

PATCH Su Hui 2 participants 2 messages Oct 30, 2023 – Nov 1, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20231027145949.243f03f2@jic23-huawei

Su Hui

author
#1 lore raw
Quoted 9 lines · Jonathan Cameron
Quoted 4 lines · On Mon, 23 Oct 2023 12:05:52 +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.

If you can figure out a fixes tag that would be great. Just reply to this thread with it and I'll pick it up from here.

Oh, I just send a v3 patch, sorry....

Fixes d5098447147c ("iio: imu: mpu6050: add calibration offset support")
Quoted 28 lines
Quoted 28 lines

---
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;
#2 lore raw
Quoted 4 lines · On Mon, 30 Oct 2023 10:10:05 +0800 Su Hui <[email protected]> wrote:
Quoted 3 lines · Jonathan Cameron

On Mon, 23 Oct 2023 12:05:52 +0800
Su Hui <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the true value rather than only return IIO_VAL_INT.

If you can figure out a fixes tag that would be great. Just reply to this thread with it and I'll pick it up from here.

Oh, I just send a v3 patch, sorry....

Fixes d5098447147c ("iio: imu: mpu6050: add calibration offset support")

That works too!

Thanks,

J

Quoted 29 lines
Quoted 28 lines
Quoted 28 lines

---
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;