From: OpenOCD-Gerrit <ope...@us...> - 2021-06-26 13:42:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 0478a93ed52fd8ddc0f68434cb2f05f22cbcad70 (commit) from 2044df3dac715e5bf03a2ebac87048f808d1c7b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0478a93ed52fd8ddc0f68434cb2f05f22cbcad70 Author: Marc Schink <de...@za...> Date: Tue Jun 15 16:49:37 2021 +0200 target/breakpoints: Remove dead code and cleanup Change-Id: I8027178b6e771753775514a8641a050c6e63a1d5 Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/6321 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index c060c7cde..dc8f3c573 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -50,11 +50,8 @@ static int breakpoint_add_internal(struct target *target, struct breakpoint **breakpoint_p = &target->breakpoints; const char *reason; int retval; - int n; - n = 0; while (breakpoint) { - n++; if (breakpoint->address == address) { /* FIXME don't assume "same address" means "same * breakpoint" ... check all the parameters before @@ -114,11 +111,8 @@ static int context_breakpoint_add_internal(struct target *target, struct breakpoint *breakpoint = target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints; int retval; - int n; - n = 0; while (breakpoint) { - n++; if (breakpoint->asid == asid) { /* FIXME don't assume "same address" means "same * breakpoint" ... check all the parameters before @@ -167,10 +161,8 @@ static int hybrid_breakpoint_add_internal(struct target *target, struct breakpoint *breakpoint = target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints; int retval; - int n; - n = 0; + while (breakpoint) { - n++; if ((breakpoint->asid == asid) && (breakpoint->address == address)) { /* FIXME don't assume "same address" means "same * breakpoint" ... check all the parameters before @@ -238,8 +230,9 @@ int breakpoint_add(struct target *target, head = head->next; } return retval; - } else + } else { return breakpoint_add_internal(target, address, length, type); + } } int context_breakpoint_add(struct target *target, @@ -260,8 +253,9 @@ int context_breakpoint_add(struct target *target, head = head->next; } return retval; - } else + } else { return context_breakpoint_add_internal(target, asid, length, type); + } } int hybrid_breakpoint_add(struct target *target, @@ -301,7 +295,7 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint breakpoint = breakpoint->next; } - if (breakpoint == NULL) + if (!breakpoint) return; retval = target_remove_breakpoint(target, breakpoint); @@ -346,20 +340,21 @@ static void breakpoint_remove_all_internal(struct target *target) void breakpoint_remove(struct target *target, target_addr_t address) { - int found = 0; if (target->smp) { + unsigned int num_breakpoints = 0; struct target_list *head; struct target *curr; head = target->head; while (head != (struct target_list *)NULL) { curr = head->target; - found += breakpoint_remove_internal(curr, address); + num_breakpoints += breakpoint_remove_internal(curr, address); head = head->next; } - if (found == 0) + if (!num_breakpoints) LOG_ERROR("no breakpoint at address " TARGET_ADDR_FMT " found", address); - } else + } else { breakpoint_remove_internal(target, address); + } } void breakpoint_remove_all(struct target *target) @@ -397,9 +392,9 @@ void breakpoint_clear_target(struct target *target) breakpoint_clear_target_internal(curr); head = head->next; } - } else + } else { breakpoint_clear_target_internal(target); - + } } struct breakpoint *breakpoint_find(struct target *target, target_addr_t address) @@ -494,7 +489,7 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint watchpoint = watchpoint->next; } - if (watchpoint == NULL) + if (!watchpoint) return; retval = target_remove_watchpoint(target, watchpoint); LOG_DEBUG("free WPID: %d --> %d", watchpoint->unique_id, retval); ----------------------------------------------------------------------- Summary of changes: src/target/breakpoints.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) hooks/post-receive -- Main OpenOCD repository |