summaryrefslogtreecommitdiff
path: root/src/flash/nor
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-05-03 15:50:39 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-05-04 09:11:21 +0200
commit70226c221f5879bb6126ff3f2ec9ae64c68d80d6 (patch)
treee7607b593b2cc2001662fee3c072aa33d94fdf51 /src/flash/nor
parent8865209545dae9c2745927758a51c60f922e02ca (diff)
downloadopenocd_libswd-70226c221f5879bb6126ff3f2ec9ae64c68d80d6.tar.gz
openocd_libswd-70226c221f5879bb6126ff3f2ec9ae64c68d80d6.tar.bz2
openocd_libswd-70226c221f5879bb6126ff3f2ec9ae64c68d80d6.tar.xz
openocd_libswd-70226c221f5879bb6126ff3f2ec9ae64c68d80d6.zip
str7x: fix bogus error messages
Remove bogus error messages when trying to allocate a large chunk of target memory and then falling back to a smaller one. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash/nor')
-rw-r--r--src/flash/nor/str7x.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c
index d5e8e288..556dec26 100644
--- a/src/flash/nor/str7x.c
+++ b/src/flash/nor/str7x.c
@@ -355,10 +355,9 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer,
};
/* flash write code */
- if (target_alloc_working_area(target, sizeof(str7x_flash_write_code),
+ if (target_alloc_working_area_try(target, sizeof(str7x_flash_write_code),
&str7x_info->write_algorithm) != ERROR_OK)
{
- LOG_WARNING("no working area available, can't do block memory writes");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
};
@@ -367,7 +366,7 @@ static int str7x_write_block(struct flash_bank *bank, uint8_t *buffer,
(uint8_t*)str7x_flash_write_code);
/* memory buffer */
- while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK)
+ while (target_alloc_working_area_try(target, buffer_size, &source) != ERROR_OK)
{
buffer_size /= 2;
if (buffer_size <= 256)
@@ -499,6 +498,9 @@ static int str7x_write(struct flash_bank *bank, uint8_t *buffer,
/* if block write failed (no sufficient working area),
* we use normal (slow) single dword accesses */
LOG_WARNING("couldn't use block writes, falling back to single memory accesses");
+ } else
+ {
+ return retval;
}
else if (retval == ERROR_FLASH_OPERATION_FAILED)
{