BZ: 24383
During the reprogramming of the registers during BUFFER_DONE event
the loop iteration variable used is modified inside the loop which
in some case lead to an infinite loop. This condition is avoided
by using a temporary variable to hold the calculated value.
Change-Id: Icce13cf019c04a70673fa774c274937dec7c48ff
Signed-off-by: Shreyas Neerebailoor <shreyasx.neerebailoor@intel.com>
Reviewed-on: http://android.intel.com:8080/37244
Reviewed-by: Monroy, German <german.monroy@intel.com>
Reviewed-by: Agarwal, Vaibhav <vaibhav.agarwal@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Reviewed-by: M, Arulselvan <arulselvan.m@intel.com>
Tested-by: M, Arulselvan <arulselvan.m@intel.com>
Reviewed-by: Abdullah, Omair M <omair.m.abdullah@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
buf_id += (intr_count - 1);
/* Reprogram registers*/
for (i = buff_done; i < buf_id; i++) {
- i = i % 4;
- buf_size = intelhaddata->buf_info[i].buf_size;
- buf_addr = intelhaddata->buf_info[i].buf_addr;
+ int j = i % 4;
+ buf_size = intelhaddata->buf_info[j].buf_size;
+ buf_addr = intelhaddata->buf_info[j].buf_addr;
had_write_register(AUD_BUF_A_LENGTH +
- (i * HAD_REG_WIDTH), buf_size);
+ (j * HAD_REG_WIDTH), buf_size);
had_write_register(
- AUD_BUF_A_ADDR+(i * HAD_REG_WIDTH),
+ AUD_BUF_A_ADDR+(j * HAD_REG_WIDTH),
(buf_addr | BIT(0) | BIT(1)));
}
buf_id = buf_id % 4;