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