aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeniy Naydanov <109669442+en-sc@users.noreply.github.com>2025-03-20 12:38:03 +0300
committerGitHub <noreply@github.com>2025-03-20 12:38:03 +0300
commit92aadd153e9244120c74d414939ac20239063586 (patch)
treee0c3c58712d4b6253ee595a8473e8ff88f9c5fae /src
parentc380b7c80f2c52dc78d2fc63c853b65817664968 (diff)
parentece1827613d527d95aced1a1952e92ee86af56f9 (diff)
downloadriscv-openocd-92aadd153e9244120c74d414939ac20239063586.zip
riscv-openocd-92aadd153e9244120c74d414939ac20239063586.tar.gz
riscv-openocd-92aadd153e9244120c74d414939ac20239063586.tar.bz2
Merge pull request #1240 from en-sc/en-sc/ebreak-cfg-update
target/riscv: avoid `config` modification on `jim_getopt_obj()` failure
Diffstat (limited to 'src')
-rw-r--r--src/target/riscv/riscv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 1ca1fb3..a55fc14 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -534,9 +534,12 @@ static int jim_configure_ebreak(struct riscv_private_config *config, struct jim_
/* Here a common "ebreak" action is processed, e.g:
* "riscv.cpu configure -ebreak halt"
*/
+ int res = jim_getopt_obj(goi, NULL);
+ if (res != JIM_OK)
+ return res;
for (int ebreak_ctl_i = 0; ebreak_ctl_i < N_RISCV_MODE; ++ebreak_ctl_i)
config->dcsr_ebreak_fields[ebreak_ctl_i] = common_mode_nvp->value;
- return jim_getopt_obj(goi, NULL);
+ return JIM_OK;
}
/* Here a "ebreak" action for a specific execution mode is processed, e.g: