Commit 16b6b5e7 authored by Mathias K's avatar Mathias K Committed by Øyvind Harboe
Browse files

Change return value on error.



On wrong parameters a error is signalized to the calling function.

Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960
Signed-off-by: default avatarMathias K <kesmtp@freenet.de>
Signed-off-by: default avatarØyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/282


Tested-by: jenkins
Reviewed-by: default avatarØyvind Harboe <oyvindharboe@gmail.com>
parent 42cb62cf
......@@ -904,8 +904,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command)
if (CMD_ARGC != 1)
{
command_print(CMD_CTX, "usage: arm920t read_cache <filename>");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
......@@ -1199,8 +1198,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command)
if (CMD_ARGC != 1)
{
command_print(CMD_CTX, "usage: arm920t read_mmu <filename>");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
......@@ -1650,8 +1648,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
}
else
{
command_print(CMD_CTX,
"usage: arm920t cp15i <opcode> [value] [address]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
......
......@@ -784,10 +784,8 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
break;
default:
usage:
command_print(CMD_CTX,
"usage: arm disassemble <address> [<count> ['thumb']]");
count = 0;
retval = ERROR_FAIL;
retval = ERROR_COMMAND_SYNTAX_ERROR;
}
while (count-- > 0) {
......
......@@ -1268,13 +1268,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
&tracemode);
break;
default:
command_print(CMD_CTX, "usage: tracemode "
"('none'|'data'|'address'|'all') "
"context_id_bits "
"('enable'|'disable') "
"('enable'|'disable')"
);
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
/**
......@@ -1738,8 +1732,7 @@ COMMAND_HANDLER(handle_etm_image_command)
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "usage: etm image <file> [base address] [type]");
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
......@@ -1799,8 +1792,7 @@ COMMAND_HANDLER(handle_etm_dump_command)
if (CMD_ARGC != 1)
{
command_print(CMD_CTX, "usage: etm dump <file>");
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
......@@ -1866,8 +1858,7 @@ COMMAND_HANDLER(handle_etm_load_command)
if (CMD_ARGC != 1)
{
command_print(CMD_CTX, "usage: etm load <file>");
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
......@@ -2206,7 +2197,7 @@ static const struct command_registration etm_exec_command_handlers[] = {
.handler = handle_etm_image_command,
.mode = COMMAND_EXEC,
.help = "load image from file with optional offset",
.usage = "filename [offset]",
.usage = "<file> [base address] [type]",
},
{
.name = "dump",
......
......@@ -797,7 +797,7 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
command_print(CMD_CTX, "command requires more arguments.");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
......
......@@ -1140,7 +1140,7 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
command_print(CMD_CTX, "command requires more arguments.");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
......
......@@ -284,8 +284,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command)
if (CMD_ARGC != 2)
{
LOG_ERROR("incomplete 'oocd_trace config <target> <tty>' command");
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
......@@ -400,7 +399,7 @@ static const struct command_registration oocd_trace_all_command_handlers[] = {
.name = "config",
.handler = handle_oocd_trace_config_command,
.mode = COMMAND_CONFIG,
.usage = "target",
.usage = "<target> <tty>",
},
{
.name = "status",
......
......@@ -2246,9 +2246,7 @@ COMMAND_HANDLER(handle_reg_command)
return ERROR_OK;
}
command_print(CMD_CTX, "usage: reg <#|name> [value]");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_HANDLER(handle_poll_command)
......@@ -2295,7 +2293,6 @@ COMMAND_HANDLER(handle_wait_halt_command)
int retval = parse_uint(CMD_ARGV[0], &ms);
if (ERROR_OK != retval)
{
command_print(CMD_CTX, "usage: %s [seconds]", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
// convert seconds (given) to milliseconds (needed)
......@@ -3155,7 +3152,6 @@ COMMAND_HANDLER(handle_bp_command)
return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
default:
command_print(CMD_CTX, "usage: bp <address> [<asid>]<length> ['hw'|'hw_ctx']");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
......@@ -3235,8 +3231,6 @@ COMMAND_HANDLER(handle_wp_command)
break;
default:
command_print(CMD_CTX, "usage: wp [address length "
"[(r|w|a) [value [mask]]]]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
......
......@@ -302,7 +302,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command)
}
else
{
command_print(CMD_CTX, "usage: target_request debugmsgs ['enable'|'disable'|'charmsg']");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
......
......@@ -3212,8 +3212,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command)
if (CMD_ARGC < 2)
{
LOG_ERROR("'xscale debug_handler <target#> <address>' command takes two required operands");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target(CMD_ARGV[0])) == NULL)
......@@ -3416,7 +3415,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command)
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "usage: xscale vector_catch [mask]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
......@@ -3483,7 +3482,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command)
}
if (err)
command_print(CMD_CTX, "usage: xscale vector_table <high|low> <index> <code>");
return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_OK;
}
......@@ -3569,8 +3568,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "usage: xscale trace_image <file> [base address] [type]");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
retval = xscale_verify_pointer(CMD_CTX, xscale);
......@@ -3629,8 +3627,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "usage: xscale dump_trace <file>");
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
trace_data = xscale->trace.data;
......@@ -3763,7 +3760,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
}
else
{
command_print(CMD_CTX, "usage: cp15 [register]<, [value]>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
......@@ -3859,7 +3856,7 @@ static const struct command_registration xscale_any_command_handlers[] = {
.handler = xscale_handle_debug_handler_command,
.mode = COMMAND_ANY,
.help = "Change address used for debug handler.",
.usage = "target address",
.usage = "<target> <address>",
},
{
.name = "cache_clean_address",
......
......@@ -221,8 +221,7 @@ COMMAND_HANDLER(handle_xsvf_command)
if (CMD_ARGC < 2)
{
command_print(CMD_CTX, "usage: xsvf <device#|plain> <file> [<variant>] [quiet]");
return ERROR_FAIL;
return ERROR_COMMAND_SYNTAX_ERROR;
}
/* we mess with CMD_ARGV starting point below, snapshot filename here */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment