mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-30 00:20:44 +09:00
efi_loader: incorrect return value form DisconnectController
DisconnectController() should never return EFI_NOT_FOUND. If EFI_DRIVER_BINDING_PROTOCOL.Stop() fails, return EFI_DEVICE_ERROR. If the driver handle does not expose the EFI_DRIVER_BINDING_PROTOCOL return EFI_INVALID_PARAMETER. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
23ad52fff4
commit
7dc10c933c
@ -3499,7 +3499,6 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
efi_handle_t *child_handle_buffer = NULL;
|
efi_handle_t *child_handle_buffer = NULL;
|
||||||
size_t number_of_children = 0;
|
size_t number_of_children = 0;
|
||||||
efi_status_t r;
|
efi_status_t r;
|
||||||
size_t stop_count = 0;
|
|
||||||
struct efi_object *efiobj;
|
struct efi_object *efiobj;
|
||||||
|
|
||||||
EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
|
EFI_ENTRY("%p, %p, %p", controller_handle, driver_image_handle,
|
||||||
@ -3539,32 +3538,35 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
(void **)&binding_protocol,
|
(void **)&binding_protocol,
|
||||||
driver_image_handle, NULL,
|
driver_image_handle, NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL));
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL));
|
||||||
if (r != EFI_SUCCESS)
|
if (r != EFI_SUCCESS) {
|
||||||
|
r = EFI_INVALID_PARAMETER;
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
/* Remove the children */
|
/* Remove the children */
|
||||||
if (number_of_children) {
|
if (number_of_children) {
|
||||||
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
||||||
controller_handle,
|
controller_handle,
|
||||||
number_of_children,
|
number_of_children,
|
||||||
child_handle_buffer));
|
child_handle_buffer));
|
||||||
if (r == EFI_SUCCESS)
|
if (r != EFI_SUCCESS) {
|
||||||
++stop_count;
|
r = EFI_DEVICE_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Remove the driver */
|
/* Remove the driver */
|
||||||
if (!child_handle)
|
if (!child_handle) {
|
||||||
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
r = EFI_CALL(binding_protocol->stop(binding_protocol,
|
||||||
controller_handle,
|
controller_handle,
|
||||||
0, NULL));
|
0, NULL));
|
||||||
if (r == EFI_SUCCESS)
|
if (r != EFI_SUCCESS) {
|
||||||
++stop_count;
|
r = EFI_DEVICE_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
EFI_CALL(efi_close_protocol(driver_image_handle,
|
EFI_CALL(efi_close_protocol(driver_image_handle,
|
||||||
&efi_guid_driver_binding_protocol,
|
&efi_guid_driver_binding_protocol,
|
||||||
driver_image_handle, NULL));
|
driver_image_handle, NULL));
|
||||||
|
r = EFI_SUCCESS;
|
||||||
if (stop_count)
|
|
||||||
r = EFI_SUCCESS;
|
|
||||||
else
|
|
||||||
r = EFI_NOT_FOUND;
|
|
||||||
out:
|
out:
|
||||||
if (!child_handle)
|
if (!child_handle)
|
||||||
free(child_handle_buffer);
|
free(child_handle_buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user