Skip to contentSkip to conversation

thermal: imx_scu_thermal: prevent boot hang with zero pdata

PATCH New Anatolij Gustschin 1 participant 2 messages May 20, 2020 – May 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: imx_scu_thermal: prevent boot hang with zero pdata

Should initialization of pdata values have failed for some reason, we end up in endless loop when getting the CPU temperature value and can not boot. Check alert value in pdata and only retry reading temperature if alert value is not zero. Also shorten the temperature info string.

---
 drivers/thermal/imx_scu_thermal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/thermal/imx_scu_thermal.c +3 -1
index 321f905e3a..83ec753802 100644
@@ -61,13 +61,15 @@ int imx_sc_thermal_get_temp(struct udevice *dev, int *temp)
 		return ret;
 
 	while (cpu_temp >= pdata->alert) {
-		printf("CPU Temperature (%dC) has beyond alert (%dC), close to critical (%dC)",
+		printf("CPU Temperature (%dC) beyond alert (%dC), close to critical (%dC)",
 		       cpu_temp, pdata->alert, pdata->critical);
 		puts(" waiting...\n");
 		mdelay(pdata->polling_delay);
 		ret = read_temperature(dev, &cpu_temp);
 		if (ret)
 			return ret;
+		if (cpu_temp >= pdata->alert && !pdata->alert)
+			break;
 	}
 
 	*temp = cpu_temp / 1000;
Signature · 1 line
2.17.1
author Applied
#1 lore raw

PATCH 1/1 thermal: imx_scu_thermal: prevent boot hang with zero pdata

Quoted 10 lines · On Wed, 20 May 2020 10:21:53 +0200 Anatolij Gustschin agust at denx.de wrote:

Should initialization of pdata values have failed for some reason, we end up in endless loop when getting the CPU temperature value and can not boot. Check alert value in pdata and only retry reading temperature if alert value is not zero. Also shorten the temperature info string.

---
 drivers/thermal/imx_scu_thermal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied.

--
Anatolij