Re: [PATCH v3 4/4] iio: imu: inv_mpu6050: clean read channel data error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 17 Apr 2018 10:07:22 +0200
Jean-Baptiste Maneyrol <jmaneyrol@xxxxxxxxxxxxxx> wrote:

Nice to have some description of how it was cleaned + a signed-off-by...

Jonathan

> ---
>  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 a0cecd9..b842caf 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -330,7 +330,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)
> @@ -375,14 +375,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

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux