aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Naydanov <109669442+en-sc@users.noreply.github.com>2024-09-10 12:02:06 +0300
committerGitHub <noreply@github.com>2024-09-10 12:02:06 +0300
commitc85d4e1858840fe90a2fa0c521528338952d49da (patch)
tree454a69f1bd990ff24c45282c985e11248a283d06
parentc455b60ff7d4421c558f73df93587e064a5a8ac0 (diff)
parent77bffed1c49833727dac0512b2402140c0cc4797 (diff)
downloadriscv-openocd-c85d4e1858840fe90a2fa0c521528338952d49da.zip
riscv-openocd-c85d4e1858840fe90a2fa0c521528338952d49da.tar.gz
riscv-openocd-c85d4e1858840fe90a2fa0c521528338952d49da.tar.bz2
Merge pull request #1129 from rtwfroody/calloc
target/riscv: Fix calloc calls.
-rw-r--r--src/target/riscv/riscv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index b61bd55..11f3956 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -3759,7 +3759,7 @@ static int riscv_openocd_step_impl(struct target *target, int current,
return ERROR_FAIL;
RISCV_INFO(r);
- bool *wps_to_enable = calloc(sizeof(*wps_to_enable), r->trigger_count);
+ bool *wps_to_enable = calloc(r->trigger_count, sizeof(*wps_to_enable));
if (disable_watchpoints(target, wps_to_enable) != ERROR_OK) {
LOG_TARGET_ERROR(target, "Failed to temporarily disable "
"watchpoints before single-step.");
@@ -5790,7 +5790,7 @@ int riscv_enumerate_triggers(struct target *target)
r->trigger_count = t;
LOG_TARGET_INFO(target, "Found %d triggers", r->trigger_count);
free(r->reserved_triggers);
- r->reserved_triggers = calloc(sizeof(*r->reserved_triggers), t);
+ r->reserved_triggers = calloc(t, sizeof(*r->reserved_triggers));
create_wp_trigger_cache(target);
return ERROR_OK;
}