]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
thermal: imx_scu_thermal: prevent boot hang with zero pdata
authorAnatolij Gustschin <agust@denx.de>
Wed, 20 May 2020 08:21:53 +0000 (10:21 +0200)
committerAnatolij Gustschin <agust@denx.de>
Fri, 22 May 2020 11:29:25 +0000 (13:29 +0200)
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.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
drivers/thermal/imx_scu_thermal.c

index 321f905e3ac5d924240fd8ab5c688d56d215d6b7..83ec753802acc0e99d016bad41f349ef221f9df2 100644 (file)
@@ -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;