From d31a39d7fc4eb7f349406b88439047574a8bb255 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Mon, 19 Oct 2020 14:11:50 +0200 Subject: [PATCH] Refactor verification check to remove goto and label --- sys/riotboot/flashwrite.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/riotboot/flashwrite.c b/sys/riotboot/flashwrite.c index 6949006fc6..246c331c73 100644 --- a/sys/riotboot/flashwrite.c +++ b/sys/riotboot/flashwrite.c @@ -177,16 +177,13 @@ int riotboot_flashwrite_finish_raw(riotboot_flashwrite_t *state, } int flashpage = flashpage_page((void *)slot_start); - if (flashpage_write_and_verify(flashpage, firstpage) != FLASHPAGE_OK) { + if (flashpage_write_and_verify(flashpage, firstpage) == FLASHPAGE_OK) { + LOG_INFO(LOG_PREFIX "riotboot flashing completed successfully\n"); + res = 0; + } + else { LOG_WARNING(LOG_PREFIX "re-flashing first block failed!\n"); - goto out; } #endif /* !CONFIG_RIOTBOOT_FLASHWRITE_RAW */ - LOG_INFO(LOG_PREFIX "riotboot flashing completed successfully\n"); - res = 0; - -#if !CONFIG_RIOTBOOT_FLASHWRITE_RAW -out: -#endif return res; }