mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: kamil@wypas.org, b.zolnierkie@samsung.com, jdelvare@suse.com,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linux-imx@nxp.com
Subject: Re: [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error handling
Date: Fri, 21 Aug 2020 11:34:59 -0700	[thread overview]
Message-ID: <20200821183459.GA198234@roeck-us.net> (raw)
In-Reply-To: <1597649673-22329-1-git-send-email-Anson.Huang@nxp.com>

On Mon, Aug 17, 2020 at 03:34:33PM +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>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pwm-fan.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
> index 17bb642..bdba214 100644
> --- a/drivers/hwmon/pwm-fan.c
> +++ b/drivers/hwmon/pwm-fan.c
> @@ -293,14 +293,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
>  	mutex_init(&ctx->lock);
>  
>  	ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
> -	if (IS_ERR(ctx->pwm)) {
> -		ret = PTR_ERR(ctx->pwm);
> -
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "Could not get PWM: %d\n", ret);
> -
> -		return ret;
> -	}
> +	if (IS_ERR(ctx->pwm))
> +		return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
>  
>  	platform_set_drvdata(pdev, ctx);
>  

      reply	other threads:[~2020-08-21 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17  7:34 Anson Huang
2020-08-21 18:34 ` Guenter Roeck [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=20200821183459.GA198234@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=jdelvare@suse.com \
    --cc=kamil@wypas.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®