@@ -285,7 +285,7 @@ static void
285
285
bs_list (struct boot_loader_state * state , char * buf , int len )
286
286
{
287
287
struct image_header hdr ;
288
- uint32_t slot , area_id ;
288
+ uint32_t slot ;
289
289
const struct flash_area * fap ;
290
290
uint8_t image_index ;
291
291
#ifdef MCUBOOT_SERIAL_IMG_GRP_HASH
@@ -319,8 +319,8 @@ bs_list(struct boot_loader_state *state, char *buf, int len)
319
319
uint32_t start_off = 0 ;
320
320
#endif
321
321
322
- area_id = flash_area_id_from_multi_image_slot ( image_index , slot );
323
- if (flash_area_open ( area_id , & fap ) ) {
322
+ fap = BOOT_IMG_AREA ( state , slot );
323
+ if (fap == NULL ) {
324
324
continue ;
325
325
}
326
326
@@ -333,7 +333,6 @@ bs_list(struct boot_loader_state *state, char *buf, int len)
333
333
334
334
if ((rc != 0 && rc != - ENOMEM ) ||
335
335
num_sectors != SWAP_USING_OFFSET_SECTOR_UPDATE_BEGIN ) {
336
- flash_area_close (fap );
337
336
continue ;
338
337
}
339
338
@@ -395,7 +394,6 @@ bs_list(struct boot_loader_state *state, char *buf, int len)
395
394
}
396
395
397
396
if (FIH_NOT_EQ (fih_rc , FIH_SUCCESS )) {
398
- flash_area_close (fap );
399
397
continue ;
400
398
}
401
399
@@ -408,7 +406,6 @@ bs_list(struct boot_loader_state *state, char *buf, int len)
408
406
#endif
409
407
#endif
410
408
411
- flash_area_close (fap );
412
409
zcbor_map_start_encode (cbor_state , 20 );
413
410
414
411
#if (BOOT_IMAGE_NUMBER > 1 )
@@ -555,7 +552,6 @@ bs_set(struct boot_loader_state *state, char *buf, int len)
555
552
556
553
for (slot = 0 ; slot < BOOT_NUM_SLOTS ; slot ++ ) {
557
554
struct image_header hdr ;
558
- uint32_t area_id ;
559
555
const struct flash_area * fap ;
560
556
uint8_t tmpbuf [64 ];
561
557
@@ -565,9 +561,8 @@ bs_set(struct boot_loader_state *state, char *buf, int len)
565
561
uint32_t start_off = 0 ;
566
562
#endif
567
563
568
- area_id = flash_area_id_from_multi_image_slot (image_index , slot );
569
- if (flash_area_open (area_id , & fap )) {
570
- BOOT_LOG_ERR ("Failed to open flash area ID %d" , area_id );
564
+ fap = BOOT_IMG_AREA (state , slot );
565
+ if (fap == NULL ) {
571
566
continue ;
572
567
}
573
568
@@ -577,7 +572,6 @@ bs_set(struct boot_loader_state *state, char *buf, int len)
577
572
578
573
if ((rc != 0 && rc != - ENOMEM ) ||
579
574
num_sectors != SWAP_USING_OFFSET_SECTOR_UPDATE_BEGIN ) {
580
- flash_area_close (fap );
581
575
continue ;
582
576
}
583
577
@@ -641,8 +635,6 @@ bs_set(struct boot_loader_state *state, char *buf, int len)
641
635
rc = boot_serial_get_hash (& hdr , fap , hash );
642
636
#endif
643
637
#endif
644
- flash_area_close (fap );
645
-
646
638
if (rc == 0 && memcmp (hash , img_hash .value , sizeof (hash )) == 0 ) {
647
639
/* Hash matches, set this slot for test or confirmation */
648
640
found = true;
0 commit comments