Skip to content

Commit 92aadd1

Browse files
authored
Merge pull request #1240 from en-sc/en-sc/ebreak-cfg-update
target/riscv: avoid `config` modification on `jim_getopt_obj()` failure
2 parents c380b7c + ece1827 commit 92aadd1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/target/riscv/riscv.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,12 @@ static int jim_configure_ebreak(struct riscv_private_config *config, struct jim_
534534
/* Here a common "ebreak" action is processed, e.g:
535535
* "riscv.cpu configure -ebreak halt"
536536
*/
537+
int res = jim_getopt_obj(goi, NULL);
538+
if (res != JIM_OK)
539+
return res;
537540
for (int ebreak_ctl_i = 0; ebreak_ctl_i < N_RISCV_MODE; ++ebreak_ctl_i)
538541
config->dcsr_ebreak_fields[ebreak_ctl_i] = common_mode_nvp->value;
539-
return jim_getopt_obj(goi, NULL);
542+
return JIM_OK;
540543
}
541544

542545
/* Here a "ebreak" action for a specific execution mode is processed, e.g:

0 commit comments

Comments
 (0)