linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	alexandru.ardelean@analog.com, hslester96@gmail.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linux-imx@nxp.com
Subject: Re: [PATCH 1/3] iio: accel: mma8452: Use dev_err_probe() to simplify error handling
Date: Sun, 16 Aug 2020 09:54:11 +0100	[thread overview]
Message-ID: <20200816095411.4b0d943d@archlinux> (raw)
In-Reply-To: <1597117396-2894-1-git-send-email-Anson.Huang@nxp.com>

On Tue, 11 Aug 2020 11:43:14 +0800
Anson Huang <Anson.Huang@nxp.com> wrote:

> dev_err_probe() can reduce code size, uniform error handling and record the
> defer probe reason etc., use it to simplify the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Hi Anson,

All look good, but will have to wait for dev_err_probe to be in my
upstream tree which hasn't quite happened yet.  Give me a poke if 
I seem to have lost these once that is true!

Thanks,

Jonathan

> ---
>  drivers/iio/accel/mma8452.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index ba27f86..9b5f23b 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1538,22 +1538,14 @@ static int mma8452_probe(struct i2c_client *client,
>  	data->chip_info = match->data;
>  
>  	data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
> -	if (IS_ERR(data->vdd_reg)) {
> -		if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -
> -		dev_err(&client->dev, "failed to get VDD regulator!\n");
> -		return PTR_ERR(data->vdd_reg);
> -	}
> +	if (IS_ERR(data->vdd_reg))
> +		return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),
> +				     "failed to get VDD regulator!\n");
>  
>  	data->vddio_reg = devm_regulator_get(&client->dev, "vddio");
> -	if (IS_ERR(data->vddio_reg)) {
> -		if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -
> -		dev_err(&client->dev, "failed to get VDDIO regulator!\n");
> -		return PTR_ERR(data->vddio_reg);
> -	}
> +	if (IS_ERR(data->vddio_reg))
> +		return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg),
> +				     "failed to get VDDIO regulator!\n");
>  
>  	ret = regulator_enable(data->vdd_reg);
>  	if (ret) {


  parent reply	other threads:[~2020-08-16  8:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  3:43 [PATCH 1/3] iio: accel: mma8452: Use dev_err_probe() to simplify error handling Anson Huang
2020-08-11  3:43 ` [PATCH 2/3] iio: light: isl29018: " Anson Huang
2020-08-11  3:43 ` [PATCH 3/3] iio: magnetometer: mag3110: " Anson Huang
2020-08-16  8:54 ` Jonathan Cameron [this message]
2020-08-29 18:03 ` [PATCH 1/3] iio: accel: mma8452: " 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=20200816095411.4b0d943d@archlinux \
    --to=jic23@kernel.org \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=hslester96@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).