提交 880b2d6c 编写于 作者: J Jean-Baptiste Maneyrol 提交者: Jonathan Cameron

iio: imu: inv_mpu6050: clean read channel data error path

Delete the useless ored result and give a second chance to turn
the chip back off at the end.
Signed-off-by: NJean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 6792b455
......@@ -338,7 +338,7 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
{
struct inv_mpu6050_state *st = iio_priv(indio_dev);
int result;
int ret = IIO_VAL_INT;
int ret;
result = iio_device_claim_direct_mode(indio_dev);
if (result)
......@@ -383,14 +383,18 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
break;
}
result = inv_mpu6050_set_power_itg(st, false);
if (result)
goto error_power_off;
iio_device_release_direct_mode(indio_dev);
return ret;
error_power_off:
result |= inv_mpu6050_set_power_itg(st, false);
inv_mpu6050_set_power_itg(st, false);
error_release:
iio_device_release_direct_mode(indio_dev);
if (result)
return result;
return ret;
}
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册