linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v4 4/4] iio: imu: inv_mpu6050: clean read channel data error path
Date: Sat, 28 Apr 2018 16:57:17 +0100	[thread overview]
Message-ID: <20180428165717.5e127f3c@archlinux> (raw)
In-Reply-To: <1524479613-23954-4-git-send-email-jmaneyrol@invensense.com>

On Mon, 23 Apr 2018 12:33:33 +0200
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote:

> 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>
Hmm. I'm not totally sold on the 'try powering down' again
option.  That seems somewhat inelegant.  Ah well, it's a minor
thing as all sorts of horrible things will happen if we fail the second
powerdown anyway.

Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

Thanks,

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


  reply	other threads:[~2018-04-28 15:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 10:33 [PATCH v4 1/4] iio: imu: inv_mpu6050: fix error path not turning chip back off Jean-Baptiste Maneyrol
2018-04-23 10:33 ` [PATCH v4 2/4] iio: imu: inv_mpu6050: use devm_* at init and delete remove Jean-Baptiste Maneyrol
2018-04-28 15:53   ` Jonathan Cameron
2018-04-23 10:33 ` [PATCH v4 3/4] iio: imu: inv_mpu6050: clean read raw by factorizing out raw data Jean-Baptiste Maneyrol
2018-04-28 15:54   ` Jonathan Cameron
2018-04-23 10:33 ` [PATCH v4 4/4] iio: imu: inv_mpu6050: clean read channel data error path Jean-Baptiste Maneyrol
2018-04-28 15:57   ` Jonathan Cameron [this message]
2018-04-28 15:48 ` [PATCH v4 1/4] iio: imu: inv_mpu6050: fix error path not turning chip back off Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180428165717.5e127f3c@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=jmaneyrol@invensense.com \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).