linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, daniel.baluta@nxp.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Linux-imx@nxp.com
Subject: Re: [PATCH] soc: imx: gpcv2: Use dev_err_probe() to simplify error handling
Date: Tue, 11 Aug 2020 09:03:08 +0200	[thread overview]
Message-ID: <20200811070308.GB2904@bogon.m.sigxcpu.org> (raw)
In-Reply-To: <1597115082-20328-1-git-send-email-Anson.Huang@nxp.com>

Hi,
On Tue, Aug 11, 2020 at 11:04:42AM +0800, Anson Huang 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>
> ---
>  drivers/soc/imx/gpcv2.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
> index 6cf8a7a..db7e7fc 100644
> --- a/drivers/soc/imx/gpcv2.c
> +++ b/drivers/soc/imx/gpcv2.c
> @@ -487,22 +487,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
>  
>  	domain->regulator = devm_regulator_get_optional(domain->dev, "power");
>  	if (IS_ERR(domain->regulator)) {
> -		if (PTR_ERR(domain->regulator) != -ENODEV) {
> -			if (PTR_ERR(domain->regulator) != -EPROBE_DEFER)
> -				dev_err(domain->dev, "Failed to get domain's regulator\n");
> -			return PTR_ERR(domain->regulator);
> -		}
> +		if (PTR_ERR(domain->regulator) != -ENODEV)
> +			return dev_err_probe(domain->dev, PTR_ERR(domain->regulator),
> +					     "Failed to get domain's regulator\n");
>  	} else if (domain->voltage) {
>  		regulator_set_voltage(domain->regulator,
>  				      domain->voltage, domain->voltage);
>  	}
>  
>  	ret = imx_pgc_get_clocks(domain);
> -	if (ret) {
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(domain->dev, "Failed to get domain's clocks\n");
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n");
>  
>  	ret = pm_genpd_init(&domain->genpd, NULL, true);
>  	if (ret) {

Reviewed-by: Guido Günther <agx@sigxcpu.org>
 -- Guido

> -- 
> 2.7.4
> 

  reply	other threads:[~2020-08-11  7:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  3:04 [PATCH] soc: imx: gpcv2: Use dev_err_probe() to simplify error handling Anson Huang
2020-08-11  7:03 ` Guido Günther [this message]
2020-08-22 12:58 ` Shawn Guo

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=20200811070308.GB2904@bogon.m.sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=daniel.baluta@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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).