thermal: imx: 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: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/1597129185-8460-1-git-send-email-Anson.Huang@nxp.com
This commit is contained in:
parent
c071cde00b
commit
5f3c0200b1
|
@ -716,14 +716,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
|
if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
|
||||||
ret = imx_init_from_nvmem_cells(pdev);
|
ret = imx_init_from_nvmem_cells(pdev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
if (ret == -EPROBE_DEFER)
|
return dev_err_probe(&pdev->dev, ret,
|
||||||
return ret;
|
"failed to init from nvmem\n");
|
||||||
|
|
||||||
dev_err(&pdev->dev, "failed to init from nvmem: %d\n",
|
|
||||||
ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ret = imx_init_from_tempmon_data(pdev);
|
ret = imx_init_from_tempmon_data(pdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -746,14 +741,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
|
||||||
data->socdata->power_down_mask);
|
data->socdata->power_down_mask);
|
||||||
|
|
||||||
ret = imx_thermal_register_legacy_cooling(data);
|
ret = imx_thermal_register_legacy_cooling(data);
|
||||||
if (ret) {
|
if (ret)
|
||||||
if (ret == -EPROBE_DEFER)
|
return dev_err_probe(&pdev->dev, ret,
|
||||||
return ret;
|
"failed to register cpufreq cooling device\n");
|
||||||
|
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"failed to register cpufreq cooling device: %d\n", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
|
data->thermal_clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(data->thermal_clk)) {
|
if (IS_ERR(data->thermal_clk)) {
|
||||||
|
|
Loading…
Reference in New Issue