[PATCH v4 1/3] thermal: rcar_gen3: check for sensors before reading the fuses
From: Yaohan Li
Date: Tue Nov 24 2026 - 22:03:43 EST
rcar_gen3_thermal_read_fuses() dereferences tscs[0], but the check that
rejects a device without sensor resources comes after the thermal zones
have been registered. Move the check up, so that a device exposing no
memory resource is rejected before the fuse reader touches tscs[0].
Signed-off-by: Yaohan Li <shunsheng1218@xxxxxxxxx>
---
Prepared against v7.4-rc1-1969-g666539eecdf4.
Compile tested only: arm64, aarch64-linux-gnu-gcc 11.4,
CONFIG_ARCH_RENESAS and CONFIG_RCAR_GEN3_THERMAL.
AI assistance: prepared with Claude (Anthropic) as a coding assistant; the
author reviewed the reasoning and takes responsibility for the content.
---
drivers/thermal/renesas/rcar_gen3_thermal.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/renesas/rcar_gen3_thermal.c b/drivers/thermal/renesas/rcar_gen3_thermal.c
index 9c64cbc2ee67..a96f02d4a8ad 100644
--- a/drivers/thermal/renesas/rcar_gen3_thermal.c
+++ b/drivers/thermal/renesas/rcar_gen3_thermal.c
@@ -557,6 +557,10 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
}
priv->num_tscs = i;
+ if (!priv->num_tscs) {
+ ret = -ENODEV;
+ goto error_unregister;
+ }
if (!rcar_gen3_thermal_read_fuses(priv))
dev_info(dev, "No calibration values fused, fallback to driver values\n");
@@ -588,11 +592,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
dev_info(dev, "Sensor %u: Loaded\n", i);
}
- if (!priv->num_tscs) {
- ret = -ENODEV;
- goto error_unregister;
- }
-
return 0;
error_unregister:
--
2.34.1