@@ -12,15 +12,11 @@ pub(crate) const BOOT_SERVICES_ERROR: io::Error =
12
12
const_io_error ! ( io:: ErrorKind :: Other , "failed to acquire boot services" , ) ;
13
13
pub ( crate ) const RUNTIME_SERVICES_ERROR : io:: Error =
14
14
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" , ) ;
19
15
20
16
/// Get the Protocol for current system handle.
21
17
/// Note: Some protocols need to be manually freed. It is the callers responsibility to do so.
22
18
pub ( 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 ( ) ;
24
20
open_protocol ( system_handle, protocol_guid) . ok ( )
25
21
}
26
22
@@ -240,7 +236,7 @@ pub(crate) fn open_protocol<T>(
240
236
mut protocol_guid : Guid ,
241
237
) -> io:: Result < NonNull < T > > {
242
238
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 ( ) ;
244
240
let mut protocol: MaybeUninit < * mut T > = MaybeUninit :: uninit ( ) ;
245
241
246
242
let r = unsafe {
@@ -469,14 +465,14 @@ where
469
465
470
466
/// Get the BootServices Pointer.
471
467
pub ( 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 ( ) ;
473
469
let boot_services = unsafe { ( * system_table. as_ptr ( ) ) . boot_services } ;
474
470
NonNull :: new ( boot_services)
475
471
}
476
472
477
473
/// Get the RuntimeServices Pointer.
478
474
pub ( 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 ( ) ;
480
476
let runtime_services = unsafe { ( * system_table. as_ptr ( ) ) . runtime_services } ;
481
477
NonNull :: new ( runtime_services)
482
478
}
0 commit comments