Commit b779bbb9 authored by Yan Zhen's avatar Yan Zhen Committed by Daniel Lezcano

thermal/drivers/brcmstb_thermal: Simplify with dev_err_probe()

dev_err_probe() is used to log an error message during the probe process
of a device.

It can simplify the error path and unify a message template.

Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.
Signed-off-by: default avatarYan Zhen <yanzhen@vivo.com>
Link: https://lore.kernel.org/r/20240830103918.501234-1-yanzhen@vivo.comSigned-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 8e12f1f8
...@@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) ...@@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv, thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
of_ops); of_ops);
if (IS_ERR(thermal)) { if (IS_ERR(thermal))
ret = PTR_ERR(thermal); return dev_err_probe(&pdev->dev, PTR_ERR(thermal),
dev_err(&pdev->dev, "could not register sensor: %d\n", ret); "could not register sensor\n");
return ret;
}
priv->thermal = thermal; priv->thermal = thermal;
...@@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev) ...@@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
brcmstb_tmon_irq_thread, brcmstb_tmon_irq_thread,
IRQF_ONESHOT, IRQF_ONESHOT,
DRV_NAME, priv); DRV_NAME, priv);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "could not request IRQ: %d\n", ret); return dev_err_probe(&pdev->dev, ret,
return ret; "could not request IRQ\n");
}
} }
dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n"); dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
......
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