Skip to content

Commit b779bbb

Browse files
Yan Zhendlezcano
authored andcommitted
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: Yan Zhen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 8e12f1f commit b779bbb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
338338

339339
thermal = devm_thermal_of_zone_register(&pdev->dev, 0, priv,
340340
of_ops);
341-
if (IS_ERR(thermal)) {
342-
ret = PTR_ERR(thermal);
343-
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
344-
return ret;
345-
}
341+
if (IS_ERR(thermal))
342+
return dev_err_probe(&pdev->dev, PTR_ERR(thermal),
343+
"could not register sensor\n");
346344

347345
priv->thermal = thermal;
348346

@@ -352,10 +350,9 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
352350
brcmstb_tmon_irq_thread,
353351
IRQF_ONESHOT,
354352
DRV_NAME, priv);
355-
if (ret < 0) {
356-
dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
357-
return ret;
358-
}
353+
if (ret < 0)
354+
return dev_err_probe(&pdev->dev, ret,
355+
"could not request IRQ\n");
359356
}
360357

361358
dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");

0 commit comments

Comments
 (0)