diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 86f5f1b42..ab5b993ce 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -832,7 +832,7 @@ static int add_trigger(struct target *target, struct trigger *trigger) uint64_t tdata1_rb; for (int hartid = 0; hartid < riscv_count_harts(target); ++hartid) { - if (!riscv_hart_enabled(target, i)) + if (!riscv_hart_enabled(target, hartid)) continue; riscv_set_current_hartid(target, hartid); @@ -921,7 +921,7 @@ static int remove_trigger(struct target *target, struct trigger *trigger) } LOG_DEBUG("Stop using resource %d for bp %d", i, trigger->unique_id); for (int hartid = 0; hartid < riscv_count_harts(target); ++hartid) { - if (!riscv_hart_enabled(target, i)) + if (!riscv_hart_enabled(target, hartid)) continue; riscv_set_current_hartid(target, hartid);