[PATCH 05/12] thermal: Remove redundant error log prints
Xichao Zhao
zhao.xichao at vivo.com
Fri Sep 5 00:23:57 PDT 2025
devm_thermal_of_zone_register() prints error log messages when
it fails, so there is no need to print error log messages again.
Signed-off-by: Xichao Zhao <zhao.xichao at vivo.com>
---
drivers/thermal/airoha_thermal.c | 4 +---
drivers/thermal/amlogic_thermal.c | 7 ++-----
drivers/thermal/armada_thermal.c | 2 --
drivers/thermal/db8500_thermal.c | 5 ++---
drivers/thermal/hisi_thermal.c | 7 +------
drivers/thermal/imx8mm_thermal.c | 3 ---
drivers/thermal/imx_sc_thermal.c | 2 +-
drivers/thermal/k3_bandgap.c | 1 -
drivers/thermal/k3_j72xx_bandgap.c | 1 -
drivers/thermal/loongson2_thermal.c | 2 +-
drivers/thermal/rockchip_thermal.c | 8 ++------
drivers/thermal/sprd_thermal.c | 2 --
drivers/thermal/thermal-generic-adc.c | 10 ++--------
drivers/thermal/thermal_mmio.c | 6 +-----
drivers/thermal/uniphier_thermal.c | 4 +---
15 files changed, 14 insertions(+), 50 deletions(-)
diff --git a/drivers/thermal/airoha_thermal.c b/drivers/thermal/airoha_thermal.c
index b9fd6bfc88e5..1994b62df04b 100644
--- a/drivers/thermal/airoha_thermal.c
+++ b/drivers/thermal/airoha_thermal.c
@@ -454,10 +454,8 @@ static int airoha_thermal_probe(struct platform_device *pdev)
/* register of thermal sensor and get info from DT */
priv->tz = devm_thermal_of_zone_register(dev, 0, priv, &thdev_ops);
- if (IS_ERR(priv->tz)) {
- dev_err(dev, "register thermal zone sensor failed\n");
+ if (IS_ERR(priv->tz))
return PTR_ERR(priv->tz);
- }
platform_set_drvdata(pdev, priv);
diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index 5448d772db12..03f806248df1 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -282,11 +282,8 @@ static int amlogic_thermal_probe(struct platform_device *pdev)
0,
pdata,
&amlogic_thermal_ops);
- if (IS_ERR(pdata->tzd)) {
- ret = PTR_ERR(pdata->tzd);
- dev_err(dev, "Failed to register tsensor: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(pdata->tzd))
+ return PTR_ERR(pdata->tzd);
devm_thermal_add_hwmon_sysfs(&pdev->dev, pdata->tzd);
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index c2fbdb534f61..22145b6cb2d9 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -938,8 +938,6 @@ static int armada_thermal_probe(struct platform_device *pdev)
sensor->id, sensor,
&of_ops);
if (IS_ERR(tz)) {
- dev_info(&pdev->dev, "Thermal sensor %d unavailable\n",
- sensor_id);
devm_kfree(&pdev->dev, sensor);
continue;
}
diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index 576f88b6a1b3..891a4ed639f0 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -186,10 +186,9 @@ static int db8500_thermal_probe(struct platform_device *pdev)
/* register of thermal sensor and get info from DT */
th->tz = devm_thermal_of_zone_register(dev, 0, th, &thdev_ops);
- if (IS_ERR(th->tz)) {
- dev_err(dev, "register thermal zone sensor failed\n");
+ if (IS_ERR(th->tz))
return PTR_ERR(th->tz);
- }
+
dev_info(dev, "thermal zone sensor registered\n");
/* Start measuring at the lowest point */
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 4307161533a7..30181ac8cf47 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -480,17 +480,12 @@ static int hisi_trip_walk_cb(struct thermal_trip *trip, void *arg)
static int hisi_thermal_register_sensor(struct platform_device *pdev,
struct hisi_thermal_sensor *sensor)
{
- int ret;
-
sensor->tzd = devm_thermal_of_zone_register(&pdev->dev,
sensor->id, sensor,
&hisi_of_thermal_ops);
if (IS_ERR(sensor->tzd)) {
- ret = PTR_ERR(sensor->tzd);
sensor->tzd = NULL;
- dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
- sensor->id, ret);
- return ret;
+ return PTR_ERR(sensor->tzd);
}
thermal_zone_for_each_trip(sensor->tzd, hisi_trip_walk_cb, sensor);
diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index 719d71f5b235..0776b7b0675f 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -333,9 +333,6 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
&tmu_tz_ops);
if (IS_ERR(tmu->sensors[i].tzd)) {
ret = PTR_ERR(tmu->sensors[i].tzd);
- dev_err(&pdev->dev,
- "failed to register thermal zone sensor[%d]: %d\n",
- i, ret);
goto disable_clk;
}
tmu->sensors[i].hw_id = i;
diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
index 88558ce58880..6a36e5f54a51 100644
--- a/drivers/thermal/imx_sc_thermal.c
+++ b/drivers/thermal/imx_sc_thermal.c
@@ -111,7 +111,7 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
if (ret == -ENODEV)
continue;
- return dev_err_probe(&pdev->dev, ret, "failed to register thermal zone\n");
+ return ret;
}
devm_thermal_add_hwmon_sysfs(&pdev->dev, sensor->tzd);
diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
index 678d6ed711b5..4cd61e916ff7 100644
--- a/drivers/thermal/k3_bandgap.c
+++ b/drivers/thermal/k3_bandgap.c
@@ -216,7 +216,6 @@ static int k3_bandgap_probe(struct platform_device *pdev)
&data[id],
&k3_of_thermal_ops);
if (IS_ERR(data[id].tzd)) {
- dev_err(dev, "thermal zone device is NULL\n");
ret = PTR_ERR(data[id].tzd);
goto err_alloc;
}
diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
index a36289e61315..fabb42fa6df7 100644
--- a/drivers/thermal/k3_j72xx_bandgap.c
+++ b/drivers/thermal/k3_j72xx_bandgap.c
@@ -509,7 +509,6 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
ti_thermal = devm_thermal_of_zone_register(bgp->dev, id, &data[id],
&k3_of_thermal_ops);
if (IS_ERR(ti_thermal)) {
- dev_err(bgp->dev, "thermal zone device is NULL\n");
ret = PTR_ERR(ti_thermal);
goto err_free_ref_table;
}
diff --git a/drivers/thermal/loongson2_thermal.c b/drivers/thermal/loongson2_thermal.c
index ea4dd2fb1f47..ce978db950e7 100644
--- a/drivers/thermal/loongson2_thermal.c
+++ b/drivers/thermal/loongson2_thermal.c
@@ -168,7 +168,7 @@ static int loongson2_thermal_probe(struct platform_device *pdev)
if (PTR_ERR(tzd) != -ENODEV)
continue;
- return dev_err_probe(dev, PTR_ERR(tzd), "failed to register");
+ return PTR_ERR(tzd);
}
ret = devm_request_threaded_irq(dev, irq, NULL, loongson2_thermal_irq_thread,
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 3beff9b6fac3..adf46b74ecc7 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -1681,12 +1681,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
sensor->id = id;
sensor->tzd = devm_thermal_of_zone_register(dev, id, sensor,
&rockchip_of_thermal_ops);
- if (IS_ERR(sensor->tzd)) {
- error = PTR_ERR(sensor->tzd);
- dev_err(dev, "failed to register sensor %d: %d\n",
- id, error);
- return error;
- }
+ if (IS_ERR(sensor->tzd))
+ return PTR_ERR(sensor->tzd);
return 0;
}
diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
index e546067c9621..d92964a931a4 100644
--- a/drivers/thermal/sprd_thermal.c
+++ b/drivers/thermal/sprd_thermal.c
@@ -409,8 +409,6 @@ static int sprd_thm_probe(struct platform_device *pdev)
sen,
&sprd_thm_ops);
if (IS_ERR(sen->tzd)) {
- dev_err(&pdev->dev, "register thermal zone failed %d\n",
- sen->id);
ret = PTR_ERR(sen->tzd);
goto of_put;
}
diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
index ee3d0aa31406..b370c7ed808b 100644
--- a/drivers/thermal/thermal-generic-adc.c
+++ b/drivers/thermal/thermal-generic-adc.c
@@ -142,14 +142,8 @@ static int gadc_thermal_probe(struct platform_device *pdev)
gti->tz_dev = devm_thermal_of_zone_register(dev, 0, gti,
&gadc_thermal_ops);
- if (IS_ERR(gti->tz_dev)) {
- ret = PTR_ERR(gti->tz_dev);
- if (ret != -EPROBE_DEFER)
- dev_err(dev,
- "Thermal zone sensor register failed: %d\n",
- ret);
- return ret;
- }
+ if (IS_ERR(gti->tz_dev))
+ return PTR_ERR(gti->tz_dev);
devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
index 6845756ad5e7..bd302dae5047 100644
--- a/drivers/thermal/thermal_mmio.c
+++ b/drivers/thermal/thermal_mmio.c
@@ -69,12 +69,8 @@ static int thermal_mmio_probe(struct platform_device *pdev)
0,
sensor,
&thermal_mmio_ops);
- if (IS_ERR(thermal_zone)) {
- dev_err(&pdev->dev,
- "failed to register sensor (%ld)\n",
- PTR_ERR(thermal_zone));
+ if (IS_ERR(thermal_zone))
return PTR_ERR(thermal_zone);
- }
thermal_mmio_get_temperature(thermal_zone, &temperature);
dev_info(&pdev->dev,
diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
index 1a04294effea..a5e6353f2da7 100644
--- a/drivers/thermal/uniphier_thermal.c
+++ b/drivers/thermal/uniphier_thermal.c
@@ -308,10 +308,8 @@ static int uniphier_tm_probe(struct platform_device *pdev)
tdev->tz_dev = devm_thermal_of_zone_register(dev, 0, tdev,
&uniphier_of_thermal_ops);
- if (IS_ERR(tdev->tz_dev)) {
- dev_err(dev, "failed to register sensor device\n");
+ if (IS_ERR(tdev->tz_dev))
return PTR_ERR(tdev->tz_dev);
- }
/* set alert temperatures */
twd.tdev = tdev;
--
2.34.1
More information about the linux-amlogic
mailing list