@@ -12,15 +12,11 @@ pub(crate) const BOOT_SERVICES_ERROR: io::Error =
1212 const_io_error ! ( io:: ErrorKind :: Other , "failed to acquire boot services" , ) ;
1313pub ( crate ) const RUNTIME_SERVICES_ERROR : io:: Error =
1414 const_io_error ! ( io:: ErrorKind :: Other , "failed to acquire runtime services" , ) ;
15- pub ( crate ) const SYSTEM_TABLE_ERROR : io:: Error =
16- const_io_error ! ( io:: ErrorKind :: Other , "failed to acquire system table" , ) ;
17- pub ( crate ) const IMAGE_HANDLE_ERROR : io:: Error =
18- const_io_error ! ( io:: ErrorKind :: Other , "failed to acquire system handle" , ) ;
1915
2016/// Get the Protocol for current system handle.
2117/// Note: Some protocols need to be manually freed. It is the callers responsibility to do so.
2218pub ( crate ) fn get_current_handle_protocol < T > ( protocol_guid : Guid ) -> Option < NonNull < T > > {
23- let system_handle = uefi:: env:: image_handle ( ) ? ;
19+ let system_handle = uefi:: env:: image_handle ( ) ;
2420 open_protocol ( system_handle, protocol_guid) . ok ( )
2521}
2622
@@ -240,7 +236,7 @@ pub(crate) fn open_protocol<T>(
240236 mut protocol_guid : Guid ,
241237) -> io:: Result < NonNull < T > > {
242238 let boot_services = get_boot_services ( ) . ok_or ( BOOT_SERVICES_ERROR ) ?;
243- let system_handle = uefi:: env:: image_handle ( ) . ok_or ( IMAGE_HANDLE_ERROR ) ? ;
239+ let system_handle = uefi:: env:: image_handle ( ) ;
244240 let mut protocol: MaybeUninit < * mut T > = MaybeUninit :: uninit ( ) ;
245241
246242 let r = unsafe {
@@ -469,14 +465,14 @@ where
469465
470466/// Get the BootServices Pointer.
471467pub ( crate ) fn get_boot_services ( ) -> Option < NonNull < r_efi:: efi:: BootServices > > {
472- let system_table: NonNull < r_efi:: efi:: SystemTable > = uefi:: env:: system_table ( ) ? . cast ( ) ;
468+ let system_table: NonNull < r_efi:: efi:: SystemTable > = uefi:: env:: system_table ( ) . cast ( ) ;
473469 let boot_services = unsafe { ( * system_table. as_ptr ( ) ) . boot_services } ;
474470 NonNull :: new ( boot_services)
475471}
476472
477473/// Get the RuntimeServices Pointer.
478474pub ( crate ) fn get_runtime_services ( ) -> Option < NonNull < r_efi:: efi:: RuntimeServices > > {
479- let system_table: NonNull < r_efi:: efi:: SystemTable > = uefi:: env:: system_table ( ) ? . cast ( ) ;
475+ let system_table: NonNull < r_efi:: efi:: SystemTable > = uefi:: env:: system_table ( ) . cast ( ) ;
480476 let runtime_services = unsafe { ( * system_table. as_ptr ( ) ) . runtime_services } ;
481477 NonNull :: new ( runtime_services)
482478}
0 commit comments