Fix riscv013_invalidate_cached_progbuf() off by one error

See https://github.com/riscv-collab/riscv-openocd/issues/1139
riscv013_invalidate_cached_progbuf() was failing to zeroize the final
buffer array element. Use memset() instead of a manual loop to zeroize
it in order to address this and simplify the code.
This commit is contained in:
Tommy Murphy 2024-10-02 21:08:24 +01:00
parent 841b61adf3
commit 16fa57da41
1 changed files with 1 additions and 2 deletions

View File

@ -5282,8 +5282,7 @@ static int riscv013_invalidate_cached_progbuf(struct target *target)
}
LOG_TARGET_DEBUG(target, "Invalidating progbuf cache");
for (unsigned int i = 0; i < 15; i++)
dm->progbuf_cache[i] = 0;
memset(dm->progbuf_cache, 0, sizeof(dm->progbuf_cache));
return ERROR_OK;
}