stm32: return early upon block write failure
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 8 Nov 2010 15:53:24 +0000 (16:53 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 9 Nov 2010 07:12:51 +0000 (08:12 +0100)
only if we do not have enough ram do we continue.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/flash/nor/stm32x.c

index 63a137c196438aefa27884928f84a5d2b0f87c1d..6b46afc8d543bdfefe10b9365d12b441a1cba343 100644 (file)
@@ -668,6 +668,9 @@ static int stm32x_write(struct flash_bank *bank, uint8_t *buffer,
                }
        }
 
+       if ((retval != ERROR_OK) && (retval != ERROR_TARGET_RESOURCE_NOT_AVAILABLE))
+               return retval;
+
        while (words_remaining > 0)
        {
                uint16_t value;