target: return error if attempting to access non-existing registers

Change-Id: Ic22edcab46d21dbc71f78275a78bdea9c2bcc394
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7886
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Parshintsev Anatoly 2023-09-05 21:08:02 +03:00 committed by Antonio Borneo
parent d20304b3fb
commit 2f17449dff
1 changed files with 2 additions and 2 deletions

View File

@ -3116,7 +3116,7 @@ COMMAND_HANDLER(handle_reg_command)
if (!reg) {
command_print(CMD, "%i is out of bounds, the current target "
"has only %i registers (0 - %i)", num, count, count - 1);
return ERROR_OK;
return ERROR_FAIL;
}
} else {
/* access a single register by its name */
@ -3175,7 +3175,7 @@ COMMAND_HANDLER(handle_reg_command)
not_found:
command_print(CMD, "register %s not found in current target", CMD_ARGV[0]);
return ERROR_OK;
return ERROR_FAIL;
}
COMMAND_HANDLER(handle_poll_command)