diff options
author | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-10-15 11:44:36 +0000 |
---|---|---|
committer | oharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-10-15 11:44:36 +0000 |
commit | ccc2e3fe760a425f831b9e1f0e143d7d01d73a25 (patch) | |
tree | ccb4bbe1c3221f1438d12a04cdc203617d18d5ee /src/flash/at91sam7.c | |
parent | af41e6aac8d2aadf2bcfc84a77ac0f9ded8e7830 (diff) | |
download | riscv-openocd-ccc2e3fe760a425f831b9e1f0e143d7d01d73a25.zip riscv-openocd-ccc2e3fe760a425f831b9e1f0e143d7d01d73a25.tar.gz riscv-openocd-ccc2e3fe760a425f831b9e1f0e143d7d01d73a25.tar.bz2 |
Laurentiu Cocanu - memory read/write and exit() error path fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1064 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/at91sam7.c')
-rw-r--r-- | src/flash/at91sam7.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 69b89c0..10ef55b 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -983,6 +983,7 @@ int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last) int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) { + int retval; at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv; target_t *target = bank->target; u32 dst_min_alignment, wcount, bytes_remaining = count; @@ -1033,7 +1034,10 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) /* Write one block to the PageWriteBuffer */ buffer_pos = (pagen-first_page)*dst_min_alignment; wcount = CEIL(count,4); - target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos); + if((retval = target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK) + { + return retval; + } /* Send Write Page command to Flash Controller */ if (at91sam7_flash_command(bank, WP, pagen) != ERROR_OK) |