Skip to content

Commit

Permalink
target: return error if attempting to access non-existing registers
Browse files Browse the repository at this point in the history
Change-Id: Ic22edcab46d21dbc71f78275a78bdea9c2bcc394
Signed-off-by: Parshintsev Anatoly <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/7886
Reviewed-by: Tim Newsome <[email protected]>
Reviewed-by: Jan Matyas <[email protected]>
Reviewed-by: Marek Vrbka <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
  • Loading branch information
aap-sc authored and borneoa committed Oct 7, 2023
1 parent d20304b commit 2f17449
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/target/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2f17449

Please sign in to comment.