Skip to content

Commit 57c9eaa

Browse files
z3ntudlezcano
authored andcommitted
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: Luca Weiss <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 85b21fd commit 57c9eaa

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

drivers/thermal/qcom/qcom-spmi-temp-alarm.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -411,22 +411,19 @@ static int qpnp_tm_probe(struct platform_device *pdev)
411411
chip->base = res;
412412

413413
ret = qpnp_tm_read(chip, QPNP_TM_REG_TYPE, &type);
414-
if (ret < 0) {
415-
dev_err(&pdev->dev, "could not read type\n");
416-
return ret;
417-
}
414+
if (ret < 0)
415+
return dev_err_probe(&pdev->dev, ret,
416+
"could not read type\n");
418417

419418
ret = qpnp_tm_read(chip, QPNP_TM_REG_SUBTYPE, &subtype);
420-
if (ret < 0) {
421-
dev_err(&pdev->dev, "could not read subtype\n");
422-
return ret;
423-
}
419+
if (ret < 0)
420+
return dev_err_probe(&pdev->dev, ret,
421+
"could not read subtype\n");
424422

425423
ret = qpnp_tm_read(chip, QPNP_TM_REG_DIG_MAJOR, &dig_major);
426-
if (ret < 0) {
427-
dev_err(&pdev->dev, "could not read dig_major\n");
428-
return ret;
429-
}
424+
if (ret < 0)
425+
return dev_err_probe(&pdev->dev, ret,
426+
"could not read dig_major\n");
430427

431428
if (type != QPNP_TM_TYPE || (subtype != QPNP_TM_SUBTYPE_GEN1
432429
&& subtype != QPNP_TM_SUBTYPE_GEN2)) {
@@ -448,16 +445,13 @@ static int qpnp_tm_probe(struct platform_device *pdev)
448445
*/
449446
chip->tz_dev = devm_thermal_of_zone_register(
450447
&pdev->dev, 0, chip, &qpnp_tm_sensor_ops);
451-
if (IS_ERR(chip->tz_dev)) {
452-
dev_err(&pdev->dev, "failed to register sensor\n");
453-
return PTR_ERR(chip->tz_dev);
454-
}
448+
if (IS_ERR(chip->tz_dev))
449+
return dev_err_probe(&pdev->dev, PTR_ERR(chip->tz_dev),
450+
"failed to register sensor\n");
455451

456452
ret = qpnp_tm_init(chip);
457-
if (ret < 0) {
458-
dev_err(&pdev->dev, "init failed\n");
459-
return ret;
460-
}
453+
if (ret < 0)
454+
return dev_err_probe(&pdev->dev, ret, "init failed\n");
461455

462456
devm_thermal_add_hwmon_sysfs(&pdev->dev, chip->tz_dev);
463457

0 commit comments

Comments
 (0)