Commit 57c9eaa4 authored by Luca Weiss's avatar Luca Weiss Committed by Daniel Lezcano

thermal/drivers/qcom/temp-alarm: Use dev_err_probe

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed message includes the return value and also handles
-EPROBE_DEFER nicely.
Signed-off-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230625-spmi-temp-alarm-defer-v1-1-2d57acf36855@z3ntu.xyz
parent 85b21fde
...@@ -411,22 +411,19 @@ static int qpnp_tm_probe(struct platform_device *pdev) ...@@ -411,22 +411,19 @@ static int qpnp_tm_probe(struct platform_device *pdev)
chip->base = res; chip->base = res;
ret = qpnp_tm_read(chip, QPNP_TM_REG_TYPE, &type); ret = qpnp_tm_read(chip, QPNP_TM_REG_TYPE, &type);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "could not read type\n"); return dev_err_probe(&pdev->dev, ret,
return ret; "could not read type\n");
}
ret = qpnp_tm_read(chip, QPNP_TM_REG_SUBTYPE, &subtype); ret = qpnp_tm_read(chip, QPNP_TM_REG_SUBTYPE, &subtype);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "could not read subtype\n"); return dev_err_probe(&pdev->dev, ret,
return ret; "could not read subtype\n");
}
ret = qpnp_tm_read(chip, QPNP_TM_REG_DIG_MAJOR, &dig_major); ret = qpnp_tm_read(chip, QPNP_TM_REG_DIG_MAJOR, &dig_major);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "could not read dig_major\n"); return dev_err_probe(&pdev->dev, ret,
return ret; "could not read dig_major\n");
}
if (type != QPNP_TM_TYPE || (subtype != QPNP_TM_SUBTYPE_GEN1 if (type != QPNP_TM_TYPE || (subtype != QPNP_TM_SUBTYPE_GEN1
&& subtype != QPNP_TM_SUBTYPE_GEN2)) { && subtype != QPNP_TM_SUBTYPE_GEN2)) {
...@@ -448,16 +445,13 @@ static int qpnp_tm_probe(struct platform_device *pdev) ...@@ -448,16 +445,13 @@ static int qpnp_tm_probe(struct platform_device *pdev)
*/ */
chip->tz_dev = devm_thermal_of_zone_register( chip->tz_dev = devm_thermal_of_zone_register(
&pdev->dev, 0, chip, &qpnp_tm_sensor_ops); &pdev->dev, 0, chip, &qpnp_tm_sensor_ops);
if (IS_ERR(chip->tz_dev)) { if (IS_ERR(chip->tz_dev))
dev_err(&pdev->dev, "failed to register sensor\n"); return dev_err_probe(&pdev->dev, PTR_ERR(chip->tz_dev),
return PTR_ERR(chip->tz_dev); "failed to register sensor\n");
}
ret = qpnp_tm_init(chip); ret = qpnp_tm_init(chip);
if (ret < 0) { if (ret < 0)
dev_err(&pdev->dev, "init failed\n"); return dev_err_probe(&pdev->dev, ret, "init failed\n");
return ret;
}
devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev); devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev);
......
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