* [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error handling
@ 2020-08-17 7:34 Anson Huang
2020-08-21 18:34 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Anson Huang @ 2020-08-17 7:34 UTC (permalink / raw)
To: kamil, b.zolnierkie, jdelvare, linux, linux-hwmon, linux-kernel; +Cc: Linux-imx
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/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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error handling
2020-08-17 7:34 [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error handling Anson Huang
@ 2020-08-21 18:34 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-08-21 18:34 UTC (permalink / raw)
To: Anson Huang
Cc: kamil, b.zolnierkie, jdelvare, linux-hwmon, linux-kernel, Linux-imx
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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-21 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 7:34 [PATCH] hwmon: pwm-fan: Use dev_err_probe() to simplify error handling Anson Huang
2020-08-21 18:34 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.