@@ -6,8 +6,8 @@ use super::{common::CurrentUpdate, ComponentUpdater};
66use crate :: mgs_handler:: { BorrowedUpdateBuffer , UpdateBuffer } ;
77use core:: ops:: Range ;
88use drv_hf_api:: {
9- HfDevSelect , HfError , HfPersistentData , HfProtectMode , HostFlash ,
10- PAGE_SIZE_BYTES , SECTOR_SIZE_BYTES ,
9+ HfDevSelect , HfError , HfProtectMode , HostFlash , PAGE_SIZE_BYTES ,
10+ SECTOR_SIZE_BYTES ,
1111} ;
1212use gateway_messages:: {
1313 ComponentUpdatePrepare , HfError as GwHfError , SpComponent , SpError ,
@@ -82,15 +82,10 @@ impl HostFlashUpdate {
8282 }
8383
8484 pub ( crate ) fn persistent_slot ( & self ) -> Result < u16 , SpError > {
85- match self . task . get_persistent_data ( ) {
86- Ok ( HfPersistentData { dev_select } ) => {
87- Ok ( Self :: dev_to_slot ( dev_select) )
88- }
89- // All boards today will default to slot 0 if no persistent data,
90- // e.g. on initial power-on.
91- Err ( HfError :: NoPersistentData ) => Ok ( 0 ) ,
92- Err ( err) => Err ( hf_to_gwhf ( err) ) ,
93- }
85+ self . task
86+ . get_persistent_data ( )
87+ . map ( |data| Self :: dev_to_slot ( data. dev_select ) )
88+ . map_err ( hf_to_gwhf)
9489 }
9590
9691 fn dev_to_slot ( dev : HfDevSelect ) -> u16 {
0 commit comments