From: Jonathan Cameron <jic23@kernel.org>
To: Adriana Reus <adriana.reus@intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: light: pa12203001: Poweroff chip if register fails
Date: Sun, 8 Nov 2015 15:35:12 +0000 [thread overview]
Message-ID: <563F6BB0.1030505@kernel.org> (raw)
In-Reply-To: <1446801037-11453-1-git-send-email-adriana.reus@intel.com>
On 06/11/15 09:10, Adriana Reus wrote:
> Make sure we poweroff the chip if for any reason iio_register
> returns an error.
>
> Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Good spot.
Applied to the togreg branch of iio.git - initially pushed out as
testing etc etc.
Jonathan
> ---
> drivers/iio/light/pa12203001.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c
> index 45f7bde..76a9e12 100644
> --- a/drivers/iio/light/pa12203001.c
> +++ b/drivers/iio/light/pa12203001.c
> @@ -381,17 +381,23 @@ static int pa12203001_probe(struct i2c_client *client,
> return ret;
>
> ret = pm_runtime_set_active(&client->dev);
> - if (ret < 0) {
> - pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE);
> - return ret;
> - }
> + if (ret < 0)
> + goto out_err;
>
> pm_runtime_enable(&client->dev);
> pm_runtime_set_autosuspend_delay(&client->dev,
> PA12203001_SLEEP_DELAY_MS);
> pm_runtime_use_autosuspend(&client->dev);
>
> - return iio_device_register(indio_dev);
> + ret = iio_device_register(indio_dev);
> + if (ret < 0)
> + goto out_err;
> +
> + return 0;
> +
> +out_err:
> + pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE);
> + return ret;
> }
>
> static int pa12203001_remove(struct i2c_client *client)
>
prev parent reply other threads:[~2015-11-08 15:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 9:10 [PATCH] iio: light: pa12203001: Poweroff chip if register fails Adriana Reus
2015-11-08 15:35 ` Jonathan Cameron [this message]
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=563F6BB0.1030505@kernel.org \
--to=jic23@kernel.org \
--cc=adriana.reus@intel.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