X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstr9x.c;fp=src%2Fflash%2Fnor%2Fstr9x.c;h=674522c73464047bf5e482b01aab79018289ca86;hp=5bea2068c523f95c30ff8bf3094e0bed7dc3882a;hb=afe95871c59f05d532529af84e1ee80e3845e923;hpb=5f83378a9ca788e8a27e298b9e2b8969c944988b diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index 5bea2068c5..674522c734 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -618,14 +618,9 @@ static int str9x_write(struct flash_bank *bank, if (bytes_remaining) { uint8_t last_halfword[2] = {0xff, 0xff}; - i = 0; - while (bytes_remaining > 0) - { - last_halfword[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } + /* copy the last remaining bytes into the write buffer */ + memcpy(last_halfword, buffer+bytes_written, bytes_remaining); bank_adr = address & ~0x03;