* [PATCH v2 4/4] iio: imu: inv_mpu6050: clean read channel data error path
@ 2018-04-09 14:59 Jean-Baptiste Maneyrol
0 siblings, 0 replies; only message in thread
From: Jean-Baptiste Maneyrol @ 2018-04-09 14:59 UTC (permalink / raw)
To: linux-iio
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 16 ++++++++++------
1 file 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 50d352f..02437ed 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -324,7 +324,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)
@@ -369,14 +369,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
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-04-09 14:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09 14:59 [PATCH v2 4/4] iio: imu: inv_mpu6050: clean read channel data error path Jean-Baptiste Maneyrol
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.