diff options
-rw-r--r-- | src/flash/at91sam7.c | 2 | ||||
-rw-r--r-- | src/flash/cfi.c | 2 | ||||
-rw-r--r-- | src/helper/command.c | 9 | ||||
-rw-r--r-- | src/jtag/jtag.c | 23 |
4 files changed, 24 insertions, 12 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 0115c18b..907302eb 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -674,7 +674,7 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last) int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) { - u32 cmd, pagen, status; + u32 cmd, pagen; u8 flashplane; int lockregion; diff --git a/src/flash/cfi.c b/src/flash/cfi.c index b952bb7f..ee99408e 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -2046,7 +2046,7 @@ int cfi_info(struct flash_bank_s *bank, char *buf, int buf_size) int printed; cfi_flash_bank_t *cfi_info = bank->driver_priv; - if (cfi_info->qry[0] == -1) + if (cfi_info->qry[0] == (char)-1) { printed = snprintf(buf, buf_size, "\ncfi flash bank not probed yet\n"); return ERROR_OK; diff --git a/src/helper/command.c b/src/helper/command.c index 11284a1c..f69deb49 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -383,7 +383,11 @@ int command_run_file(command_context_t *context, FILE *file, enum command_mode m { int retval = ERROR_OK; int old_command_mode; - char buffer[4096]; + char *buffer=malloc(4096); + if (buffer==NULL) + { + return ERROR_INVALID_ARGUMENTS; + } old_command_mode = context->mode; context->mode = mode; @@ -422,6 +426,9 @@ int command_run_file(command_context_t *context, FILE *file, enum command_mode m } context->mode = old_command_mode; + + + free(buffer); return retval; } diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 09cffef7..6356bec6 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -1446,7 +1446,8 @@ int jtag_init(struct command_context_s *cmd_ctx) if (validate_tries > 5) { ERROR("Could not validate JTAG chain, exit"); - exit(-1); + jtag = NULL; + return ERROR_JTAG_INVALID_INTERFACE; } usleep(10000); } @@ -1568,8 +1569,9 @@ int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, ch jtag_reset_config = RESET_TRST_AND_SRST; else { - ERROR("invalid reset_config argument"); - exit(-1); + ERROR("invalid reset_config argument, defaulting to none"); + jtag_reset_config = RESET_NONE; + return ERROR_INVALID_ARGUMENTS; } } @@ -1585,8 +1587,9 @@ int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, ch jtag_reset_config &= ~(RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST); else { - ERROR("invalid reset_config argument"); - exit(-1); + ERROR("invalid reset_config argument, defaulting to none"); + jtag_reset_config = RESET_NONE; + return ERROR_INVALID_ARGUMENTS; } } @@ -1598,8 +1601,9 @@ int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, ch jtag_reset_config &= ~RESET_TRST_OPEN_DRAIN; else { - ERROR("invalid reset_config argument"); - exit(-1); + ERROR("invalid reset_config argument, defaulting to none"); + jtag_reset_config = RESET_NONE; + return ERROR_INVALID_ARGUMENTS; } } @@ -1611,8 +1615,9 @@ int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, ch jtag_reset_config &= ~RESET_SRST_PUSH_PULL; else { - ERROR("invalid reset_config argument"); - exit(-1); + ERROR("invalid reset_config argument, defaulting to none"); + jtag_reset_config = RESET_NONE; + return ERROR_INVALID_ARGUMENTS; } } |