aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/str9xpec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flash/nor/str9xpec.c')
-rw-r--r--src/flash/nor/str9xpec.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index 6fa66a09..0e095a30 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -714,14 +714,9 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer,
if (bytes_remaining)
{
uint8_t last_dword[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- i = 0;
- while (bytes_remaining > 0)
- {
- last_dword[i++] = *(buffer + bytes_written);
- bytes_remaining--;
- bytes_written++;
- }
+ /* copy the last remaining bytes into the write buffer */
+ memcpy(last_dword, buffer+bytes_written, bytes_remaining);
str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);