MALI: fix thermal crash with booting up
authorCaesar Wang <wxt@rock-chips.com>
Tue, 25 Apr 2017 09:53:39 +0000 (17:53 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 27 Apr 2017 11:26:43 +0000 (19:26 +0800)
If the temperature(sbs-battery) reaches the switch_on_temp, it would try
to calculate requested power of all thermal instances. Then hit the
crash[0] caused by the gpu thermal sensor, since the thermal driver had not
registered in time.

[0]
[    0.827943] Call trace:
[    0.827953] [<          (null)>]           (null)
[    0.827969] [<ffffffc00070af1c>] get_static_power+0xd8/0xe8
[    0.827981] [<ffffffc00070b190>] devfreq_cooling_get_requested_power+0x94/0x170
[    0.827997] [<ffffffc0007094c8>] power_allocator_throttle+0x270/0x804
..

Change-Id: I63f66e54d69115165a7b3ec798b9009c360daa62
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
drivers/gpu/arm/midgard/backend/gpu/mali_kbase_power_model_simple.c

index d965033905ca6cd7c37f371a49eec0b4bb52dd26..eeba4523199cfe13c45b1606f211be5976a7a172 100644 (file)
@@ -45,7 +45,7 @@ static unsigned long model_static_power(unsigned long voltage)
        unsigned long temp_squared, temp_cubed, temp_scaling_factor;
        const unsigned long voltage_cubed = (voltage * voltage * voltage) >> 10;
 
-       if (gpu_tz) {
+       if (!IS_ERR_OR_NULL(gpu_tz) && gpu_tz->ops->get_temp) {
                int ret;
 
                ret = gpu_tz->ops->get_temp(gpu_tz, &temperature);