@@ -123,8 +123,7 @@ where
123123                            end :  next_free. as_u64 ( ) , 
124124                            kind :  MemoryRegionKind :: Bootloader , 
125125                        } ; 
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) ; 
128127
129128                        // add unused part normally 
130129                        start = next_free; 
@@ -186,12 +185,12 @@ where
186185                } ; 
187186
188187                // 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) ; 
192191            }  else  { 
193192                // add the region normally 
194-                 Self :: add_region ( region,  regions,  & mut  next_index) . unwrap ( ) ; 
193+                 Self :: add_region ( region,  regions,  & mut  next_index) ; 
195194            } 
196195        } 
197196
@@ -207,20 +206,19 @@ where
207206        region :  MemoryRegion , 
208207        regions :  & mut  [ MaybeUninit < MemoryRegion > ] , 
209208        next_index :  & mut  usize , 
210-     )  ->  Result < ( ) ,   ( ) >   { 
209+     )  { 
211210        if  region. start  == region. end  { 
212211            // skip zero sized regions 
213-             return   Ok ( ( ) ) ; 
212+             return ; 
214213        } 
215214        unsafe  { 
216215            regions
217216                . get_mut ( * next_index) 
218-                 . ok_or ( ( ) ) ? 
217+                 . expect ( "cannot add region: no more free entries in memory map" ) 
219218                . as_mut_ptr ( ) 
220219                . write ( region) 
221220        } ; 
222221        * next_index += 1 ; 
223-         Ok ( ( ) ) 
224222    } 
225223} 
226224
0 commit comments