Commit 9d160091 authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

Remove assert from boot_status_entries

Just move error handling to caller routine.

Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 15c1467f
Loading
Loading
Loading
Loading
+1 −4
Changes for boot/bootutil/src/bootutil_misc.c: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -178,11 +178,8 @@ boot_status_entries(int image_index, const struct flash_area *fap)
    } else if (fap->fa_id == FLASH_AREA_IMAGE_PRIMARY(image_index) ||
               fap->fa_id == FLASH_AREA_IMAGE_SECONDARY(image_index)) {
        return BOOT_STATUS_STATE_COUNT * BOOT_STATUS_MAX_ENTRIES;
    } else {
        /* FIXME: make error values negative and check on caller */
        assert(0);
        return BOOT_EBADARGS;
    }
    return -1;
}

uint32_t
+3
Changes for boot/bootutil/src/loader.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -577,6 +577,9 @@ boot_read_status_bytes(const struct flash_area *fap,

    off = boot_status_off(fap);
    max_entries = boot_status_entries(BOOT_CURR_IMG(state), fap);
    if (max_entries < 0) {
        return BOOT_EBADARGS;
    }

    found = 0;
    found_idx = 0;