diff options
-rw-r--r-- | board/cr50/board.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index adaa711f93..61543647bf 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -1259,6 +1259,16 @@ static enum vendor_cmd_rc vc_invalidate_inactive_rw(enum vendor_cmd_cc code, get_program_memory_addr(SYSTEM_IMAGE_RW); } + *response_size = 0; + /* + * First check to see if the inactive region has already been + * invalidated. + */ + if (!header->magic) { + CPRINTS("%s: Inactive region already corrupted", __func__); + return VENDOR_RC_SUCCESS; + } + /* save the original flash region6 register values */ ctrl = GREAD(GLOBALSEC, FLASH_REGION6_CTRL); base_addr = GREG32(GLOBALSEC, FLASH_REGION6_BASE_ADDR); @@ -1285,8 +1295,6 @@ static enum vendor_cmd_rc vc_invalidate_inactive_rw(enum vendor_cmd_cc code, GREG32(GLOBALSEC, FLASH_REGION6_SIZE) = size; GREG32(GLOBALSEC, FLASH_REGION6_CTRL) = ctrl; - *response_size = 0; - return VENDOR_RC_SUCCESS; } DECLARE_VENDOR_COMMAND(VENDOR_CC_INVALIDATE_INACTIVE_RW, |