diff --git a/drivers/iio/industrialio-gts-helper.c b/drivers/iio/industrialio-gts-helper.c index 7653261d2dc2..0667da988295 100644 --- a/drivers/iio/industrialio-gts-helper.c +++ b/drivers/iio/industrialio-gts-helper.c @@ -375,19 +375,17 @@ static int iio_gts_build_avail_time_table(struct iio_gts *gts) for (i = gts->num_itime - 1; i >= 0; i--) { int new = gts->itime_table[i].time_us; - if (times[idx] < new) { - times[idx++] = new; - continue; - } + times[idx] = new; for (j = 0; j <= idx; j++) { if (times[j] > new) { memmove(×[j + 1], ×[j], (idx - j) * sizeof(int)); times[j] = new; - idx++; + break; } } + idx++; } /* create a list of times formatted as list of IIO_VAL_INT_PLUS_MICRO */