diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-04-12 07:14:43 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-04-12 22:00:42 +0200 |
commit | f1465c159779853d99c0a293f5d7ee53c13aa837 (patch) | |
tree | 4b1c4279041264572549e05ec91c9bf321f4ce7c /lib | |
parent | 7657ae12f38791be0b89ba5d4423439888cd749c (diff) | |
download | u-boot-f1465c159779853d99c0a293f5d7ee53c13aa837.tar.gz |
efi_loader: simplify protocol installation
By using InstallMultipleProtocolInterfaces() the coding for installing
protocol interfaces on the root node can be simplified.
Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_root_node.c | 76 |
1 files changed, 25 insertions, 51 deletions
diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c index b58d9d8c96..392f5c4951 100644 --- a/lib/efi_loader/efi_root_node.c +++ b/lib/efi_loader/efi_root_node.c @@ -26,16 +26,10 @@ struct efi_root_dp { */ efi_status_t efi_root_node_register(void) { - efi_handle_t root; - efi_status_t ret; + efi_handle_t root = NULL; struct efi_root_dp *dp; - /* Create handle */ - ret = efi_create_handle(&root); - if (ret != EFI_SUCCESS) - return ret; - - /* Install device path protocol */ + /* Create device path protocol */ dp = calloc(1, sizeof(*dp)); if (!dp) return EFI_OUT_OF_RESOURCES; @@ -51,49 +45,29 @@ efi_status_t efi_root_node_register(void) dp->end.sub_type = DEVICE_PATH_SUB_TYPE_END; dp->end.length = sizeof(struct efi_device_path); - /* Install device path protocol */ - ret = efi_add_protocol(root, &efi_guid_device_path, dp); - if (ret != EFI_SUCCESS) - goto failure; - - /* Install device path to text protocol */ - ret = efi_add_protocol(root, &efi_guid_device_path_to_text_protocol, - (void *)&efi_device_path_to_text); - if (ret != EFI_SUCCESS) - goto failure; - - /* Install device path utilities protocol */ - ret = efi_add_protocol(root, &efi_guid_device_path_utilities_protocol, - (void *)&efi_device_path_utilities); - if (ret != EFI_SUCCESS) - goto failure; - - /* Install Unicode collation protocol */ - ret = efi_add_protocol(root, &efi_guid_unicode_collation_protocol, - (void *)&efi_unicode_collation_protocol); - if (ret != EFI_SUCCESS) - goto failure; - + /* Create root node and install protocols */ + return EFI_CALL(efi_install_multiple_protocol_interfaces(&root, + /* Device path protocol */ + &efi_guid_device_path, dp, + /* Device path to text protocol */ + &efi_guid_device_path_to_text_protocol, + (void *)&efi_device_path_to_text, + /* Device path utilities protocol */ + &efi_guid_device_path_utilities_protocol, + (void *)&efi_device_path_utilities, + /* Unicode collation protocol */ + &efi_guid_unicode_collation_protocol, + (void *)&efi_unicode_collation_protocol, #if CONFIG_IS_ENABLED(EFI_LOADER_HII) - /* Install HII string protocol */ - ret = efi_add_protocol(root, &efi_guid_hii_string_protocol, - (void *)&efi_hii_string); - if (ret != EFI_SUCCESS) - goto failure; - - /* Install HII database protocol */ - ret = efi_add_protocol(root, &efi_guid_hii_database_protocol, - (void *)&efi_hii_database); - if (ret != EFI_SUCCESS) - goto failure; - - /* Install HII configuration routing protocol */ - ret = efi_add_protocol(root, &efi_guid_hii_config_routing_protocol, - (void *)&efi_hii_config_routing); - if (ret != EFI_SUCCESS) - goto failure; + /* HII string protocol */ + &efi_guid_hii_string_protocol, + (void *)&efi_hii_string, + /* HII database protocol */ + &efi_guid_hii_database_protocol, + (void *)&efi_hii_database, + /* HII configuration routing protocol */ + &efi_guid_hii_config_routing_protocol, + (void *)&efi_hii_config_routing, #endif - -failure: - return ret; + NULL)); } |