diff options
author | Andreas Färber <afaerber@suse.de> | 2016-05-08 16:46:03 +0200 |
---|---|---|
committer | Freddie Chopin <freddie.chopin@gmail.com> | 2016-05-14 11:53:39 +0100 |
commit | 4f2cc02d2761d13aa421c363fe4dc462a51628c6 (patch) | |
tree | 22e79d8ab6c994d45751a8e3595fc1c7bcd0a60a | |
parent | 866774a690095740e86035d5adc30aa1b6b4c58e (diff) | |
download | riscv-openocd-4f2cc02d2761d13aa421c363fe4dc462a51628c6.zip riscv-openocd-4f2cc02d2761d13aa421c363fe4dc462a51628c6.tar.gz riscv-openocd-4f2cc02d2761d13aa421c363fe4dc462a51628c6.tar.bz2 |
armv7m: Improve armv7m_blank_check_memory() error handling
Clean up the working area in case writing fails.
Adapted from armv7m_checksum_memory().
Change-Id: I4e5950f568ed70a72a1dcfd77e3321110b17e1de
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/3469
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
-rw-r--r-- | src/target/armv7m.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 52b394c..8662003 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -781,7 +781,7 @@ int armv7m_blank_check_memory(struct target *target, retval = target_write_buffer(target, erase_check_algorithm->address, sizeof(erase_check_code), (uint8_t *)erase_check_code); if (retval != ERROR_OK) - return retval; + goto cleanup; armv7m_info.common_magic = ARMV7M_COMMON_MAGIC; armv7m_info.core_mode = ARM_MODE_THREAD; @@ -812,6 +812,7 @@ int armv7m_blank_check_memory(struct target *target, destroy_reg_param(®_params[1]); destroy_reg_param(®_params[2]); +cleanup: target_free_working_area(target, erase_check_algorithm); return retval; |