X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstr7x.c;h=0bfe7c9e8a320aff128ee75ba6bb85b98a6ce370;hp=57f860d6aa3e8bf1a93e9fcc3f06f03426dd9cd4;hb=afe95871c59f05d532529af84e1ee80e3845e923;hpb=5f83378a9ca788e8a27e298b9e2b8969c944988b diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 57f860d6aa..0bfe7c9e8a 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -707,14 +707,9 @@ static int str7x_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); /* command */ cmd = FLASH_DWPG;