diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-10-16 13:37:59 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-10-16 13:37:59 +0000 |
commit | 824c270142ee0c30417d686c600bb33920e79aaa (patch) | |
tree | 9f2900c0d41260bac8ea67db354fe8deb06724e9 /src/flash | |
parent | e2f941b5465105d81cd75f9173b2afbee4d4b7be (diff) | |
download | openocd+libswd-824c270142ee0c30417d686c600bb33920e79aaa.tar.gz openocd+libswd-824c270142ee0c30417d686c600bb33920e79aaa.tar.bz2 openocd+libswd-824c270142ee0c30417d686c600bb33920e79aaa.tar.xz openocd+libswd-824c270142ee0c30417d686c600bb33920e79aaa.zip |
fix error handling in flash fill
git-svn-id: svn://svn.berlios.de/openocd/trunk@1074 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/flash.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c index fb9fa698..08f3aaff 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -792,20 +792,16 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char for (wrote=0; wrote<(count*wordsize); wrote+=sizeof(chunk)) { int cur_size = MIN( (count*wordsize - wrote) , 1024 ); - if (err == ERROR_OK) + flash_bank_t *bank; + bank = get_flash_bank_by_addr(target, address); + if(bank == NULL) { - flash_bank_t *bank; - bank = get_flash_bank_by_addr(target, address); - if(bank == NULL) - { - err = ERROR_FAIL; - break; - } - err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size); - wrote += cur_size; + return ERROR_FAIL; } + err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size); if (err!=ERROR_OK) - break; + return err; + wrote += cur_size; } if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) |