if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank str9x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str9x_info = malloc(sizeof(struct str9x_flash_bank));
total_timeout = 1000;
}
+ /* this is so the compiler can *know* */
+ assert(total_timeout > 0);
+
for (i = first; i <= last; i++)
{
int retval;
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;