As of now, the function to check what have triggered a thermal event is accessing wrong data area.
This patch changes the way to match the trip point triggering the thermal event. Now it won't access the memory out of its usable range.
Signed-off-by: Eduardo Valentin eduardo.valentin@ti.com --- drivers/thermal/omap_thermal.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/omap_thermal.c b/drivers/thermal/omap_thermal.c index 2d0fbc2..45c4989 100644 --- a/drivers/thermal/omap_thermal.c +++ b/drivers/thermal/omap_thermal.c @@ -172,14 +172,14 @@ void omap4_report_trigger(struct omap_thermal_zone *th_zone) /* Find the level for which trip happened */ for (i = 0; i < th_zone->therm_dev->trips; i++) { if (th_zone->therm_dev->last_temperature < - th_zone->sensor_data->trigger_levels[i - 1]) + th_zone->sensor_data->trigger_levels[i]) break; }
if (th_zone->mode == THERMAL_DEVICE_ENABLED) { - if (i > 0) + if (i < th_zone->therm_dev->trips) th_zone->therm_dev->polling_delay = - th_zone->sensor_data->freq_tab[i - 1].polling_interval; + th_zone->sensor_data->freq_tab[i].polling_interval; else th_zone->therm_dev->polling_delay = th_zone->idle_interval;