str7x: fix bogus error messages
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 3 May 2010 13:50:39 +0000 (15:50 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 4 May 2010 07:11:21 +0000 (09:11 +0200)
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>
src/flash/nor/str7x.c

index d5e8e2880821f88f9561d3946f50967767b58772..556dec260598603226a54943c4ec4e13e06ee0bb 100644 (file)
@@ -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)
                        {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)