Commit 4668bd26 authored by Øyvind Harboe's avatar Øyvind Harboe Committed by Spencer Oliver
Browse files

retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERROR



Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4
Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/300


Tested-by: jenkins
Reviewed-by: default avatarØyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
parent 54d6330b
...@@ -141,7 +141,7 @@ static int s3c2440_set_gpio_to_output (struct mflash_gpio_num gpio) ...@@ -141,7 +141,7 @@ static int s3c2440_set_gpio_to_output (struct mflash_gpio_num gpio)
gpio_con = S3C2440_GPJCON; gpio_con = S3C2440_GPJCON;
} else { } else {
LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port); LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
ret = target_read_u32(target, gpio_con, &data); ret = target_read_u32(target, gpio_con, &data);
...@@ -173,7 +173,7 @@ static int s3c2440_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val ...@@ -173,7 +173,7 @@ static int s3c2440_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val
gpio_dat = S3C2440_GPJDAT; gpio_dat = S3C2440_GPJDAT;
} else { } else {
LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port); LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
ret = target_read_u32(target, gpio_dat, &data); ret = target_read_u32(target, gpio_dat, &data);
......
...@@ -221,7 +221,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index, ...@@ -221,7 +221,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
*nand = get_nand_device_by_num(num); *nand = get_nand_device_by_num(num);
if (!*nand) { if (!*nand) {
command_print(CMD_CTX, "NAND flash device '%s' not found", str); command_print(CMD_CTX, "NAND flash device '%s' not found", str);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
return ERROR_OK; return ERROR_OK;
} }
...@@ -542,7 +542,7 @@ int nand_erase(struct nand_device *nand, int first_block, int last_block) ...@@ -542,7 +542,7 @@ int nand_erase(struct nand_device *nand, int first_block, int last_block)
return ERROR_NAND_DEVICE_NOT_PROBED; return ERROR_NAND_DEVICE_NOT_PROBED;
if ((first_block < 0) || (last_block >= nand->num_blocks)) if ((first_block < 0) || (last_block >= nand->num_blocks))
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
/* make sure we know if a block is bad before erasing it */ /* make sure we know if a block is bad before erasing it */
for (i = first_block; i <= last_block; i++) for (i = first_block; i <= last_block; i++)
......
...@@ -177,12 +177,12 @@ COMMAND_HANDLER(handle_nand_erase_command) ...@@ -177,12 +177,12 @@ COMMAND_HANDLER(handle_nand_erase_command)
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset); COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
if ((offset % p->erase_size) != 0 || offset >= size) if ((offset % p->erase_size) != 0 || offset >= size)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length); COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
if ((length == 0) || (length % p->erase_size) != 0 if ((length == 0) || (length % p->erase_size) != 0
|| (length + offset) > size) || (length + offset) > size)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
offset /= p->erase_size; offset /= p->erase_size;
length /= p->erase_size; length /= p->erase_size;
...@@ -226,12 +226,12 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command) ...@@ -226,12 +226,12 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset); COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
if (offset % p->erase_size) if (offset % p->erase_size)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
offset /= p->erase_size; offset /= p->erase_size;
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length); COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
if (length % p->erase_size) if (length % p->erase_size)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
length -= 1; length -= 1;
length /= p->erase_size; length /= p->erase_size;
......
...@@ -897,7 +897,7 @@ static int stellaris_protect(struct flash_bank *bank, int set, int first, int la ...@@ -897,7 +897,7 @@ static int stellaris_protect(struct flash_bank *bank, int set, int first, int la
{ {
LOG_ERROR("Hardware doesn't support page-level unprotect. " LOG_ERROR("Hardware doesn't support page-level unprotect. "
"Try the 'recover' command."); "Try the 'recover' command.");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (stellaris_info->did1 == 0) if (stellaris_info->did1 == 0)
......
...@@ -848,7 +848,7 @@ COMMAND_HANDLER(handle_flash_bank_command) ...@@ -848,7 +848,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
COMMAND_HANDLER(handle_flash_banks_command) COMMAND_HANDLER(handle_flash_banks_command)
{ {
if (CMD_ARGC != 0) if (CMD_ARGC != 0)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned n = 0; unsigned n = 0;
for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++)
......
...@@ -314,7 +314,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) ...@@ -314,7 +314,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
if (CMD_ARGC > 4) if (CMD_ARGC > 4)
{ {
command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
else if (CMD_ARGC == 4) else if (CMD_ARGC == 4)
{ {
...@@ -328,7 +328,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) ...@@ -328,7 +328,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
{ {
command_print(CMD_CTX, "could not process flash key %s", CMD_ARGV[i]); command_print(CMD_CTX, "could not process flash key %s", CMD_ARGV[i]);
LOG_ERROR("could not process flash key %s", CMD_ARGV[i]); LOG_ERROR("could not process flash key %s", CMD_ARGV[i]);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
} }
...@@ -337,7 +337,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) ...@@ -337,7 +337,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
else if (CMD_ARGC != 0) else if (CMD_ARGC != 0)
{ {
command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (keysSet) if (keysSet)
...@@ -378,7 +378,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command) ...@@ -378,7 +378,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
{ {
command_print(CMD_CTX, "tms470 osc_megahertz <MHz>"); command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
else if (CMD_ARGC == 1) else if (CMD_ARGC == 1)
{ {
...@@ -390,7 +390,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command) ...@@ -390,7 +390,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
LOG_ERROR("osc_megahertz must be positive and non-zero!"); LOG_ERROR("osc_megahertz must be positive and non-zero!");
command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!"); command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!");
oscMHz = 12; oscMHz = 12;
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
command_print(CMD_CTX, "osc_megahertz=%d", oscMHz); command_print(CMD_CTX, "osc_megahertz=%d", oscMHz);
...@@ -407,7 +407,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command) ...@@ -407,7 +407,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
if (CMD_ARGC > 1) if (CMD_ARGC > 1)
{ {
command_print(CMD_CTX, "tms470 plldis <0 | 1>"); command_print(CMD_CTX, "tms470 plldis <0 | 1>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
else if (CMD_ARGC == 1) else if (CMD_ARGC == 1)
{ {
......
...@@ -494,7 +494,7 @@ int unregister_command(struct command_context *context, ...@@ -494,7 +494,7 @@ int unregister_command(struct command_context *context,
struct command *parent, const char *name) struct command *parent, const char *name)
{ {
if ((!context) || (!name)) if ((!context) || (!name))
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
struct command *p = NULL; struct command *p = NULL;
struct command **head = command_list_for_parent(context, parent); struct command **head = command_list_for_parent(context, parent);
...@@ -832,12 +832,12 @@ static COMMAND_HELPER(command_help_find, struct command *head, ...@@ -832,12 +832,12 @@ static COMMAND_HELPER(command_help_find, struct command *head,
struct command **out) struct command **out)
{ {
if (0 == CMD_ARGC) if (0 == CMD_ARGC)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
*out = command_find(head, CMD_ARGV[0]); *out = command_find(head, CMD_ARGV[0]);
if (NULL == *out && strncmp(CMD_ARGV[0], "ocd_", 4) == 0) if (NULL == *out && strncmp(CMD_ARGV[0], "ocd_", 4) == 0)
*out = command_find(head, CMD_ARGV[0] + 4); *out = command_find(head, CMD_ARGV[0] + 4);
if (NULL == *out) if (NULL == *out)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
if (--CMD_ARGC == 0) if (--CMD_ARGC == 0)
return ERROR_OK; return ERROR_OK;
CMD_ARGV++; CMD_ARGV++;
...@@ -1180,7 +1180,7 @@ COMMAND_HANDLER(handle_help_add_command) ...@@ -1180,7 +1180,7 @@ COMMAND_HANDLER(handle_help_add_command)
if (CMD_ARGC < 2) if (CMD_ARGC < 2)
{ {
LOG_ERROR("%s: insufficient arguments", CMD_NAME); LOG_ERROR("%s: insufficient arguments", CMD_NAME);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
// save help text and remove it from argument list // save help text and remove it from argument list
...@@ -1190,7 +1190,7 @@ COMMAND_HANDLER(handle_help_add_command) ...@@ -1190,7 +1190,7 @@ COMMAND_HANDLER(handle_help_add_command)
if (!help && !usage) if (!help && !usage)
{ {
LOG_ERROR("command name '%s' is unknown", CMD_NAME); LOG_ERROR("command name '%s' is unknown", CMD_NAME);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
// likewise for the leaf command name // likewise for the leaf command name
const char *cmd_name = CMD_ARGV[--CMD_ARGC]; const char *cmd_name = CMD_ARGV[--CMD_ARGC];
...@@ -1399,7 +1399,7 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp ...@@ -1399,7 +1399,7 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp
int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode) int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode)
{ {
if (!cmd_ctx) if (!cmd_ctx)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
cmd_ctx->mode = mode; cmd_ctx->mode = mode;
return ERROR_OK; return ERROR_OK;
...@@ -1503,7 +1503,7 @@ int command_parse_bool_arg(const char *in, bool *out) ...@@ -1503,7 +1503,7 @@ int command_parse_bool_arg(const char *in, bool *out)
return ERROR_OK; return ERROR_OK;
if (command_parse_bool(in, out, "1", "0") == ERROR_OK) if (command_parse_bool(in, out, "1", "0") == ERROR_OK)
return ERROR_OK; return ERROR_OK;
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
...@@ -1514,7 +1514,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) ...@@ -1514,7 +1514,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
if (command_parse_bool_arg(in, out) != ERROR_OK) if (command_parse_bool_arg(in, out) != ERROR_OK)
{ {
LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in); LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
// fall through // fall through
} }
...@@ -1522,7 +1522,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) ...@@ -1522,7 +1522,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled"); LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled");
break; break;
default: default:
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
return ERROR_OK; return ERROR_OK;
} }
...@@ -63,7 +63,7 @@ static inline int fileio_open_local(struct fileio_internal *fileio) ...@@ -63,7 +63,7 @@ static inline int fileio_open_local(struct fileio_internal *fileio)
break; break;
default: default:
LOG_ERROR("BUG: access neither read, write nor readwrite"); LOG_ERROR("BUG: access neither read, write nor readwrite");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
/* win32 always opens in binary mode */ /* win32 always opens in binary mode */
......
...@@ -118,7 +118,7 @@ COMMAND_HANDLER(handle_cat_command) ...@@ -118,7 +118,7 @@ COMMAND_HANDLER(handle_cat_command)
if (CMD_ARGC != 1) if (CMD_ARGC != 1)
{ {
command_print(CMD_CTX, "cat <filename>"); command_print(CMD_CTX, "cat <filename>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
// NOTE!!! we only have line printing capability so we print the entire file as a single line. // NOTE!!! we only have line printing capability so we print the entire file as a single line.
...@@ -144,7 +144,7 @@ COMMAND_HANDLER(handle_trunc_command) ...@@ -144,7 +144,7 @@ COMMAND_HANDLER(handle_trunc_command)
if (CMD_ARGC != 1) if (CMD_ARGC != 1)
{ {
command_print(CMD_CTX, "trunc <filename>"); command_print(CMD_CTX, "trunc <filename>");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
FILE *config_file = NULL; FILE *config_file = NULL;
...@@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_meminfo_command) ...@@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_meminfo_command)
if (CMD_ARGC != 0) if (CMD_ARGC != 0)
{ {
command_print(CMD_CTX, "meminfo"); command_print(CMD_CTX, "meminfo");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
info = mallinfo(); info = mallinfo();
...@@ -186,7 +186,7 @@ COMMAND_HANDLER(handle_append_command) ...@@ -186,7 +186,7 @@ COMMAND_HANDLER(handle_append_command)
{ {
command_print(CMD_CTX, command_print(CMD_CTX,
"append <filename> [<string1>, [<string2>, ...]]"); "append <filename> [<string1>, [<string2>, ...]]");
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
int retval = ERROR_FAIL; int retval = ERROR_FAIL;
...@@ -224,7 +224,7 @@ COMMAND_HANDLER(handle_cp_command) ...@@ -224,7 +224,7 @@ COMMAND_HANDLER(handle_cp_command)
{ {
if (CMD_ARGC != 2) if (CMD_ARGC != 2)
{ {
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
// NOTE!!! we only have line printing capability so we print the entire file as a single line. // NOTE!!! we only have line printing capability so we print the entire file as a single line.
...@@ -237,7 +237,7 @@ COMMAND_HANDLER(handle_cp_command) ...@@ -237,7 +237,7 @@ COMMAND_HANDLER(handle_cp_command)
FILE *f = fopen(CMD_ARGV[1], "wb"); FILE *f = fopen(CMD_ARGV[1], "wb");
if (f == NULL) if (f == NULL)
retval = ERROR_INVALID_ARGUMENTS; retval = ERROR_COMMAND_SYNTAX_ERROR;
size_t pos = 0; size_t pos = 0;
for (;;) for (;;)
...@@ -250,7 +250,7 @@ COMMAND_HANDLER(handle_cp_command) ...@@ -250,7 +250,7 @@ COMMAND_HANDLER(handle_cp_command)
} }
if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk)) if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk))
retval = ERROR_INVALID_ARGUMENTS; retval = ERROR_COMMAND_SYNTAX_ERROR;
if (retval != ERROR_OK) if (retval != ERROR_OK)
{ {
...@@ -405,7 +405,7 @@ void copydir(char *name, char *destdir) ...@@ -405,7 +405,7 @@ void copydir(char *name, char *destdir)
COMMAND_HANDLER(handle_rm_command) COMMAND_HANDLER(handle_rm_command)
{ {
if (CMD_ARGC != 1) if (CMD_ARGC != 1)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
bool del = false; bool del = false;
if (rmdir(CMD_ARGV[0]) == 0) if (rmdir(CMD_ARGV[0]) == 0)
......
...@@ -326,7 +326,7 @@ int log_add_callback(log_callback_fn fn, void *priv) ...@@ -326,7 +326,7 @@ int log_add_callback(log_callback_fn fn, void *priv)
for (cb = log_callbacks; cb; cb = cb->next) for (cb = log_callbacks; cb; cb = cb->next)
{ {
if (cb->fn == fn && cb->priv == priv) if (cb->fn == fn && cb->priv == priv)
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
/* alloc memory, it is safe just to return in case of an error, no need for the caller to check this */ /* alloc memory, it is safe just to return in case of an error, no need for the caller to check this */
...@@ -357,7 +357,7 @@ int log_remove_callback(log_callback_fn fn, void *priv) ...@@ -357,7 +357,7 @@ int log_remove_callback(log_callback_fn fn, void *priv)
} }
/* no such item */ /* no such item */
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
/* return allocated string w/printf() result */ /* return allocated string w/printf() result */
......
...@@ -132,7 +132,6 @@ extern int debug_level; ...@@ -132,7 +132,6 @@ extern int debug_level;
* error codes < 100 * error codes < 100
*/ */
#define ERROR_OK (0) #define ERROR_OK (0)
#define ERROR_INVALID_ARGUMENTS ERROR_COMMAND_SYNTAX_ERROR
#define ERROR_NO_CONFIG_FILE (-2) #define ERROR_NO_CONFIG_FILE (-2)
#define ERROR_BUF_TOO_SMALL (-3) #define ERROR_BUF_TOO_SMALL (-3)
/* see "Error:" log entry for meaningful message to the user. The caller should /* see "Error:" log entry for meaningful message to the user. The caller should
......
...@@ -218,7 +218,7 @@ COMMAND_HANDLER(handle_reset_config_command) ...@@ -218,7 +218,7 @@ COMMAND_HANDLER(handle_reset_config_command)
if (mask & m) { if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)", LOG_ERROR("extra reset_config %s spec (%s)",
"gating", *CMD_ARGV); "gating", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (m) if (m)
goto next; goto next;
...@@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_reset_config_command) ...@@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_reset_config_command)
if (mask & m) { if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)", LOG_ERROR("extra reset_config %s spec (%s)",
"signal", *CMD_ARGV); "signal", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (m) if (m)
goto next; goto next;
...@@ -258,7 +258,7 @@ COMMAND_HANDLER(handle_reset_config_command) ...@@ -258,7 +258,7 @@ COMMAND_HANDLER(handle_reset_config_command)
if (mask & m) { if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)", LOG_ERROR("extra reset_config %s spec (%s)",
"combination", *CMD_ARGV); "combination", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (m) if (m)
goto next; goto next;
...@@ -274,7 +274,7 @@ COMMAND_HANDLER(handle_reset_config_command) ...@@ -274,7 +274,7 @@ COMMAND_HANDLER(handle_reset_config_command)
if (mask & m) { if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)", LOG_ERROR("extra reset_config %s spec (%s)",
"trst_type", *CMD_ARGV); "trst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (m) if (m)
goto next; goto next;
...@@ -290,14 +290,14 @@ COMMAND_HANDLER(handle_reset_config_command) ...@@ -290,14 +290,14 @@ COMMAND_HANDLER(handle_reset_config_command)
if (mask & m) { if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)", LOG_ERROR("extra reset_config %s spec (%s)",
"srst_type", *CMD_ARGV); "srst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (m) if (m)
goto next; goto next;
/* caller provided nonsense; fail */ /* caller provided nonsense; fail */
LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV); LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
next: next:
/* Remember the bits which were specified (mask) /* Remember the bits which were specified (mask)
......
...@@ -279,7 +279,7 @@ int jtag_register_event_callback(jtag_event_handler_t callback, void *priv) ...@@ -279,7 +279,7 @@ int jtag_register_event_callback(jtag_event_handler_t callback, void *priv)
if (callback == NULL) if (callback == NULL)
{ {
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (*callbacks_p) if (*callbacks_p)
...@@ -303,7 +303,7 @@ int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv) ...@@ -303,7 +303,7 @@ int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv)
if (callback == NULL) if (callback == NULL)
{ {
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
while (*p) while (*p)
......
...@@ -686,7 +686,7 @@ static int presto_adapter_khz(int khz, int *jtag_speed) ...@@ -686,7 +686,7 @@ static int presto_adapter_khz(int khz, int *jtag_speed)
if (khz < 0) if (khz < 0)
{ {
*jtag_speed = 0; *jtag_speed = 0;
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
} }
if (khz >= 3000) *jtag_speed = 0; if (khz >= 3000) *jtag_speed = 0;
...@@ -700,7 +700,7 @@ static int presto_jtag_speed_div(int speed, int *khz) ...@@ -700,7 +700,7 @@ static int presto_jtag_speed_div(int speed, int *khz)
if ((speed < 0) || (speed > 1000)) if ((speed < 0) || (speed > 1000))
{ {
*khz = 0; *khz = 0;
return ERROR_INVALID_ARGUMENTS; return ERROR_COMMAND_SYNTAX_ERROR;
}