summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-06-02 01:43:33 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-06-04 22:09:26 +0200
commit66ca24a9a05aa094bcdcf0784d8cc5911dc2f725 (patch)
tree5df5ae7b5ca71edab5d6535045a7d5f0c8786b8d /lib
parent8a802a2eefd36865eaa3d927d1db7af63bb2d922 (diff)
efi_loader: DisconnectController() with no driver
If DisconnectController() is called and no driver is managing ControllerHandle, return EFI_SUCCESS. UEFI SCT II 2017, 3.3.12 DisconnectController(), 5.1.3.12.4 - 5.1.3.12.6 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 54fff85e64..027bd6d4d3 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1134,11 +1134,15 @@ static efi_status_t efi_get_drivers(efi_handle_t handle,
++count;
}
}
+ *number_of_drivers = 0;
+ if (!count) {
+ *driver_handle_buffer = NULL;
+ return EFI_SUCCESS;
+ }
/*
* Create buffer. In case of duplicate driver assignments the buffer
* will be too large. But that does not harm.
*/
- *number_of_drivers = 0;
*driver_handle_buffer = calloc(count, sizeof(efi_handle_t));
if (!*driver_handle_buffer)
return EFI_OUT_OF_RESOURCES;
@@ -1194,7 +1198,8 @@ static efi_status_t efi_disconnect_all_drivers
&driver_handle_buffer);
if (ret != EFI_SUCCESS)
return ret;
-
+ if (!number_of_drivers)
+ return EFI_SUCCESS;
ret = EFI_NOT_FOUND;
while (number_of_drivers) {
r = EFI_CALL(efi_disconnect_controller(