[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200821183459.GA198234@roeck-us.net>
Date: Fri, 21 Aug 2020 11:34:59 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Anson Huang <Anson.Huang@....com>
Cc: kamil@...as.org, b.zolnierkie@...sung.com, jdelvare@...e.com,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
Linux-imx@....com
Subject: Re: [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error
handling
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@....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);
>
Powered by blists - more mailing lists