Skip to content

Commit

Permalink
thermal: exynos: fix trips limit checking in get_th_reg()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Daniel Lezcano <[email protected]>
Signed-off-by: Eduardo Valentin <[email protected]>
  • Loading branch information
bzolnier authored and Eduardo Valentin committed May 6, 2018
1 parent aef27b6 commit 3c26513
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/thermal/samsung/exynos_tmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 3c26513

Please sign in to comment.