X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstellaris.c;h=13b7071e3f813b7f57350347d7510435751660f9;hp=c855995f7d8129377f4efc0ee291f9f67bc73800;hb=afe95871c59f05d532529af84e1ee80e3845e923;hpb=16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index c855995f7d..13b7071e3f 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -1214,14 +1214,9 @@ static int stellaris_write(struct flash_bank *bank, uint8_t *buffer, uint32_t of if (bytes_remaining) { uint8_t last_word[4] = {0xff, 0xff, 0xff, 0xff}; - int i = 0; - while (bytes_remaining > 0) - { - last_word[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } + /* copy the last remaining bytes into the write buffer */ + memcpy(last_word, buffer+bytes_written, bytes_remaining); if (!(address & 0xff)) LOG_DEBUG("0x%" PRIx32 "", address);