Commit 65b2aad0 authored by Anson Huang's avatar Anson Huang Committed by Guenter Roeck

hwmon: (pwm-fan) Use dev_err_probe() to simplify error handling

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: default avatarAnson Huang <Anson.Huang@nxp.com>
Link: https://lore.kernel.org/r/1597649673-22329-1-git-send-email-Anson.Huang@nxp.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 4e1b4d22
...@@ -293,14 +293,8 @@ static int pwm_fan_probe(struct platform_device *pdev) ...@@ -293,14 +293,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
mutex_init(&ctx->lock); mutex_init(&ctx->lock);
ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL); ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
if (IS_ERR(ctx->pwm)) { if (IS_ERR(ctx->pwm))
ret = PTR_ERR(ctx->pwm); return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
if (ret != -EPROBE_DEFER)
dev_err(dev, "Could not get PWM: %d\n", ret);
return ret;
}
platform_set_drvdata(pdev, ctx); platform_set_drvdata(pdev, ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment