summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-03 09:46:32 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-06-03 09:46:32 +0000
commit32310efe1a4b55920eab1d41ab473dc989c9b8ea (patch)
treeaa2ee53a41ac28d48a6b1c19885ac2c4e504da48 /src/flash
parent17d52af2a46a65e312c200b360911fdc5d91cd4e (diff)
downloadopenocd+libswd-32310efe1a4b55920eab1d41ab473dc989c9b8ea.tar.gz
openocd+libswd-32310efe1a4b55920eab1d41ab473dc989c9b8ea.tar.bz2
openocd+libswd-32310efe1a4b55920eab1d41ab473dc989c9b8ea.tar.xz
openocd+libswd-32310efe1a4b55920eab1d41ab473dc989c9b8ea.zip
Fredrik Hederstierna: fix leak + clean up return codes
git-svn-id: svn://svn.berlios.de/openocd/trunk@697 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/str9x.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/flash/str9x.c b/src/flash/str9x.c
index 150f0f87..2904d565 100644
--- a/src/flash/str9x.c
+++ b/src/flash/str9x.c
@@ -325,7 +325,7 @@ int str9x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 cou
u32 address = bank->base + offset;
reg_param_t reg_params[4];
armv4_5_algorithm_t armv4_5_info;
- int retval;
+ int retval = ERROR_OK;
u32 str9x_flash_write_code[] = {
/* write: */
@@ -400,12 +400,13 @@ int str9x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 cou
target_free_working_area(target, source);
target_free_working_area(target, str9x_info->write_algorithm);
LOG_ERROR("error executing str9x flash write algorithm");
- return ERROR_FLASH_OPERATION_FAILED;
+ break;
}
if (buf_get_u32(reg_params[3].value, 0, 32) != 0x80)
{
- return ERROR_FLASH_OPERATION_FAILED;
+ retval = ERROR_FLASH_OPERATION_FAILED;
+ break;
}
buffer += thisrun_count * 2;
@@ -421,7 +422,7 @@ int str9x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 cou
destroy_reg_param(&reg_params[2]);
destroy_reg_param(&reg_params[3]);
- return ERROR_OK;
+ return retval;
}
int str9x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)