summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorJean-Baptiste Maneyrol <jmaneyrol@invensense.com>2018-04-23 12:33:33 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-04-28 16:55:48 +0100
commit880b2d6cfdcacbade64fabf064856a7e7ac569fd (patch)
treebe58401f8f15e8b43c6e82cb6d8156fc17c8e1db /drivers/iio
parent6792b4552b0a0b4abcc5410504a7a5716ab0e0fa (diff)
downloadop-kernel-dev-880b2d6cfdcacbade64fabf064856a7e7ac569fd.zip
op-kernel-dev-880b2d6cfdcacbade64fabf064856a7e7ac569fd.tar.gz
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: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 79b44fd..aafa777 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -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;
}
-error_power_off:
- result |= inv_mpu6050_set_power_itg(st, false);
-error_release:
- iio_device_release_direct_mode(indio_dev);
+ result = inv_mpu6050_set_power_itg(st, false);
if (result)
- return result;
+ goto error_power_off;
+ iio_device_release_direct_mode(indio_dev);
return ret;
+
+error_power_off:
+ inv_mpu6050_set_power_itg(st, false);
+error_release:
+ iio_device_release_direct_mode(indio_dev);
+ return result;
}
static int
OpenPOWER on IntegriCloud