aboutsummaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2016-05-08 16:48:50 +0200
committerFreddie Chopin <freddie.chopin@gmail.com>2016-05-14 11:54:10 +0100
commit13ff5c129011b9b52b1070bc6bbbf253c773f887 (patch)
treef2c365f80651cf6b009c8f8bd59587b551417305 /src/flash
parent4f2cc02d2761d13aa421c363fe4dc462a51628c6 (diff)
xmc4xxx: Improve xmc4xxx_blank_check_memory() error handling
Clean up working area in case writing fails. Probably inherited from armv7m_blank_check_memory(). Fix adapted from armv7m_checksum_memory(). Change-Id: I784bef481d1eba833ab6a9c34249fe9d43a16081 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3470 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/nor/xmc4xxx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/flash/nor/xmc4xxx.c b/src/flash/nor/xmc4xxx.c
index 31979302..4fa273b0 100644
--- a/src/flash/nor/xmc4xxx.c
+++ b/src/flash/nor/xmc4xxx.c
@@ -640,7 +640,7 @@ static int xmc4xxx_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;
@@ -671,6 +671,7 @@ static int xmc4xxx_blank_check_memory(struct target *target,
destroy_reg_param(&reg_params[1]);
destroy_reg_param(&reg_params[2]);
+cleanup:
target_free_working_area(target, erase_check_algorithm);
return retval;