cmd: add missing usage var
[fw/openocd] / src / flash / nor / str9x.c
index 63cfd18f70f511299d77915d8ae1cc135b79e3d1..1f2c9581385fca52c9536d3d32a9d119e9928ccd 100644 (file)
@@ -158,8 +158,7 @@ FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command)
 
        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));
@@ -619,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;
 
@@ -741,6 +735,7 @@ static const struct command_registration str9x_command_handlers[] = {
                .name = "str9x",
                .mode = COMMAND_ANY,
                .help = "str9x flash command group",
+               .usage = "",
                .chain = str9x_config_command_handlers,
        },
        COMMAND_REGISTRATION_DONE