X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib%2Fefi_selftest%2Fefi_selftest_devicepath.c;h=adcf531e90a8a164599a6385a7c28bf125b36915;hb=56419ea5f0800690b47390baee580e541342d35c;hp=1ab54ebb371b385fc16cac55c29d5cd07f1bf1a1;hpb=6c7010b779ef29a40ed66acc414f65d2f4b75ced;p=u-boot diff --git a/lib/efi_selftest/efi_selftest_devicepath.c b/lib/efi_selftest/efi_selftest_devicepath.c index 1ab54ebb37..adcf531e90 100644 --- a/lib/efi_selftest/efi_selftest_devicepath.c +++ b/lib/efi_selftest/efi_selftest_devicepath.c @@ -1,10 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * efi_selftest_devicepath * * Copyright (c) 2017 Heinrich Schuchardt * - * SPDX-License-Identifier: GPL-2.0+ - * * This unit test checks the following protocol services: * DevicePathToText */ @@ -52,7 +51,7 @@ struct efi_device_path_to_text_protocol *device_path_to_text; * Setup unit test. * * Create three handles. Install a new protocol on two of them and - * provice device paths. + * provide device paths. * * handle1 * guid interface @@ -192,31 +191,41 @@ static int teardown(void) { efi_status_t ret; - ret = boottime->uninstall_protocol_interface(&handle1, + ret = boottime->uninstall_protocol_interface(handle1, &guid_device_path, dp1); - if (ret != EFI_SUCCESS) - efi_st_todo("UninstallProtocolInterface failed\n"); - ret = boottime->uninstall_protocol_interface(&handle1, + if (ret != EFI_SUCCESS) { + efi_st_error("UninstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->uninstall_protocol_interface(handle1, &guid_protocol, &interface); - if (ret != EFI_SUCCESS) - efi_st_todo("UninstallProtocolInterface failed\n"); - ret = boottime->uninstall_protocol_interface(&handle2, + if (ret != EFI_SUCCESS) { + efi_st_error("UninstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->uninstall_protocol_interface(handle2, &guid_device_path, dp2); - if (ret != EFI_SUCCESS) - efi_st_todo("UninstallProtocolInterface failed\n"); - ret = boottime->uninstall_protocol_interface(&handle2, + if (ret != EFI_SUCCESS) { + efi_st_error("UninstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->uninstall_protocol_interface(handle2, &guid_protocol, &interface); - if (ret != EFI_SUCCESS) - efi_st_todo("UninstallProtocolInterface failed\n"); - ret = boottime->uninstall_protocol_interface(&handle3, + if (ret != EFI_SUCCESS) { + efi_st_error("UninstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } + ret = boottime->uninstall_protocol_interface(handle3, &guid_device_path, dp3); - if (ret != EFI_SUCCESS) - efi_st_todo("UninstallProtocolInterface failed\n"); + if (ret != EFI_SUCCESS) { + efi_st_error("UninstallProtocolInterface failed\n"); + return EFI_ST_FAILURE; + } if (dp1) { ret = boottime->free_pool(dp1); if (ret != EFI_SUCCESS) { @@ -299,17 +308,16 @@ static int execute(void) efi_st_error("FreePool failed\n"); return EFI_ST_FAILURE; } - ret = boottime->close_protocol(handles[i], &guid_device_path, - NULL, NULL); - if (ret != EFI_SUCCESS) - efi_st_todo("Cannot close device path protocol.\n"); + /* + * CloseProtocol cannot be called without agent handle. + * There is no need to close the device path protocol. + */ } ret = boottime->free_pool(handles); if (ret != EFI_SUCCESS) { efi_st_error("FreePool failed\n"); return EFI_ST_FAILURE; } - efi_st_printf("\n"); /* Test ConvertDevicePathToText */ string = device_path_to_text->convert_device_path_to_text( @@ -318,15 +326,14 @@ static int execute(void) efi_st_error("ConvertDevicePathToText failed\n"); return EFI_ST_FAILURE; } - efi_st_printf("dp2: %ps\n", string); if (efi_st_strcmp_16_8( string, "/VenHw(dbca4c98-6cb0-694d-0872-819c650cbbb1)/VenHw(dbca4c98-6cb0-694d-0872-819c650cbba2)") ) { + efi_st_printf("dp2: %ps\n", string); efi_st_error("Incorrect text from ConvertDevicePathToText\n"); return EFI_ST_FAILURE; } - ret = boottime->free_pool(string); if (ret != EFI_SUCCESS) { efi_st_error("FreePool failed\n"); @@ -340,17 +347,17 @@ static int execute(void) efi_st_error("ConvertDeviceNodeToText failed\n"); return EFI_ST_FAILURE; } - efi_st_printf("dp_node: %ps\n", string); - ret = boottime->free_pool(string); - if (ret != EFI_SUCCESS) { - efi_st_error("FreePool failed\n"); - return EFI_ST_FAILURE; - } if (efi_st_strcmp_16_8(string, "u-boot")) { + efi_st_printf("dp_node: %ps\n", string); efi_st_error( "Incorrect conversion by ConvertDeviceNodeToText\n"); return EFI_ST_FAILURE; } + ret = boottime->free_pool(string); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } /* Test LocateDevicePath */ remaining_dp = (struct efi_device_path *)dp3; @@ -370,13 +377,18 @@ static int execute(void) efi_st_error("ConvertDevicePathToText failed\n"); return EFI_ST_FAILURE; } - efi_st_printf("remaining device path: %ps\n", string); if (efi_st_strcmp_16_8(string, "/VenHw(dbca4c98-6cb0-694d-0872-819c650cbbc3)") ) { + efi_st_printf("remaining device path: %ps\n", string); efi_st_error("LocateDevicePath: wrong remaining device path\n"); return EFI_ST_FAILURE; } + ret = boottime->free_pool(string); + if (ret != EFI_SUCCESS) { + efi_st_error("FreePool failed\n"); + return EFI_ST_FAILURE; + } return EFI_ST_SUCCESS; }