summaryrefslogtreecommitdiff
path: root/drivers/thermal/samsung
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-04-26 13:51:21 +0200
committerEduardo Valentin <edubezval@gmail.com>2018-05-06 16:19:05 -0700
commit3c2651349bc66e4fd5a6949199a9e95fe0088f96 (patch)
treecdd9ba5d1857a6869aae74c63785731a36a95d95 /drivers/thermal/samsung
parentaef27b658b43aab1239f8eece52ce505fda0ffd4 (diff)
thermal: exynos: fix trips limit checking in get_th_reg()
of_thermal_get_ntrips() may return value bigger than supported by a given SoC (i.e. on Exynos5422/5800) so fix the code to not iterate the loop for i values >= data->ntrip. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Diffstat (limited to 'drivers/thermal/samsung')
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 5a648794b667..58cd68e9bc1c 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -311,9 +311,9 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool falling)
const struct thermal_trip * const trips =
of_thermal_get_trip_points(tz);
unsigned long temp;
- int i;
+ int i, ntrips = min_t(int, of_thermal_get_ntrips(tz), data->ntrip);
- for (i = 0; i < of_thermal_get_ntrips(tz); i++) {
+ for (i = 0; i < ntrips; i++) {
if (trips[i].type == THERMAL_TRIP_CRITICAL)
continue;