From 4ff95da6f631409e1b3340bb972e91deec0ec924 Mon Sep 17 00:00:00 2001 From: Dominik Ermel Date: Mon, 7 Aug 2023 13:53:29 +0000 Subject: [PATCH] bootuil: Replace flash_area_id_to_image with flash_area_to_image Move flash_area_get_id inside the function and rename it. Signed-off-by: Dominik Ermel --- boot/bootutil/src/bootutil_public.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/boot/bootutil/src/bootutil_public.c b/boot/bootutil/src/bootutil_public.c index 27954155d..afa601cac 100644 --- a/boot/bootutil/src/bootutil_public.c +++ b/boot/bootutil/src/bootutil_public.c @@ -472,10 +472,11 @@ boot_write_copy_done(const struct flash_area *fap) #ifndef MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP -static int flash_area_id_to_image(int id) +static int flash_area_to_image(const struct flash_area *fa) { #if BOOT_IMAGE_NUMBER > 1 uint8_t i = 0; + int id = flash_area_get_id(fa); while (i < BOOT_IMAGE_NUMBER) { if (FLASH_AREA_IMAGE_PRIMARY(i) == id || (FLASH_AREA_IMAGE_SECONDARY(i) == id)) { @@ -485,7 +486,7 @@ static int flash_area_id_to_image(int id) ++i; } #else - (void)id; + (void)fa; #endif return 0; } @@ -535,8 +536,7 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm) } else { swap_type = BOOT_SWAP_TYPE_TEST; } - rc = boot_write_swap_info(fa, swap_type, - flash_area_id_to_image(flash_area_get_id(fa))); + rc = boot_write_swap_info(fa, swap_type, flash_area_to_image(fa)); } } break;