aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParshintsev Anatoly <anatoly.parshintsev@syntacore.com>2023-09-05 21:08:02 +0300
committerAntonio Borneo <borneo.antonio@gmail.com>2023-10-07 14:43:59 +0000
commit2f17449dff3272e08f509e0f06aa08d3acf7e105 (patch)
tree62c2c20ac0124fdcc3b3170e3938ba7c910f9157 /src
parentd20304b3fb0f27f62844144837ee5b99ee040bcd (diff)
downloadriscv-openocd-2f17449dff3272e08f509e0f06aa08d3acf7e105.zip
riscv-openocd-2f17449dff3272e08f509e0f06aa08d3acf7e105.tar.gz
riscv-openocd-2f17449dff3272e08f509e0f06aa08d3acf7e105.tar.bz2
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
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 1219743..acd351a 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -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)