@@ -123,8 +123,7 @@ where
123
123
end : next_free. as_u64 ( ) ,
124
124
kind : MemoryRegionKind :: Bootloader ,
125
125
} ;
126
- Self :: add_region ( used_region, regions, & mut next_index)
127
- . expect ( "Failed to add memory region" ) ;
126
+ Self :: add_region ( used_region, regions, & mut next_index) ;
128
127
129
128
// add unused part normally
130
129
start = next_free;
@@ -186,12 +185,12 @@ where
186
185
} ;
187
186
188
187
// add the three regions (empty regions are ignored in `add_region`)
189
- Self :: add_region ( before_kernel, regions, & mut next_index) . unwrap ( ) ;
190
- Self :: add_region ( kernel, regions, & mut next_index) . unwrap ( ) ;
191
- Self :: add_region ( after_kernel, regions, & mut next_index) . unwrap ( ) ;
188
+ Self :: add_region ( before_kernel, regions, & mut next_index) ;
189
+ Self :: add_region ( kernel, regions, & mut next_index) ;
190
+ Self :: add_region ( after_kernel, regions, & mut next_index) ;
192
191
} else {
193
192
// add the region normally
194
- Self :: add_region ( region, regions, & mut next_index) . unwrap ( ) ;
193
+ Self :: add_region ( region, regions, & mut next_index) ;
195
194
}
196
195
}
197
196
@@ -207,20 +206,19 @@ where
207
206
region : MemoryRegion ,
208
207
regions : & mut [ MaybeUninit < MemoryRegion > ] ,
209
208
next_index : & mut usize ,
210
- ) -> Result < ( ) , ( ) > {
209
+ ) {
211
210
if region. start == region. end {
212
211
// skip zero sized regions
213
- return Ok ( ( ) ) ;
212
+ return ;
214
213
}
215
214
unsafe {
216
215
regions
217
216
. get_mut ( * next_index)
218
- . ok_or ( ( ) ) ?
217
+ . expect ( "cannot add region: no more free entries in memory map" )
219
218
. as_mut_ptr ( )
220
219
. write ( region)
221
220
} ;
222
221
* next_index += 1 ;
223
- Ok ( ( ) )
224
222
}
225
223
}
226
224
0 commit comments