]> git.sur5r.net Git - openocd/commitdiff
fix 'flash protect' and 'flash erase_sector'
authorEric Wetzel <thewetzel@gmail.com>
Thu, 26 Nov 2009 15:54:45 +0000 (07:54 -0800)
committerZachary T Welch <zw@superlucidity.net>
Thu, 26 Nov 2009 15:57:51 +0000 (07:57 -0800)
Command upgrading introduced two off-by-one bugs in the flash commands.
This patch fixes the 'flash {protect,erase_sector}' commands to check
that they have been passed the correct number of arguments.

Ammended during commit to fix help text for 'erase_address' too.

src/flash/flash.c

index bbdbaa8dc14e7c5025eb152b4af9e050d380cde5..7023ef97a9c3e610a92bae8380d8748c941a7fef 100644 (file)
@@ -559,7 +559,7 @@ static int flash_check_sector_parameters(struct command_context *cmd_ctx,
 
 COMMAND_HANDLER(handle_flash_erase_command)
 {
-       if (CMD_ARGC != 2)
+       if (CMD_ARGC != 3)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        uint32_t bank_nr;
@@ -599,7 +599,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
 
 COMMAND_HANDLER(handle_flash_protect_command)
 {
-       if (CMD_ARGC != 3)
+       if (CMD_ARGC != 4)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        uint32_t bank_nr;
@@ -1316,7 +1316,7 @@ static const struct command_registration flash_exec_command_handlers[] = {
                .name = "erase_address",
                .handler = &handle_flash_erase_address_command,
                .mode = COMMAND_EXEC,
-               .usage = "<bank> <address> <length>",
+               .usage = "<address> <length>",
                .help = "erase address range",
 
        },