mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 04:46:01 +01:00
efi_loader: function to unlink udevice and handle
When deleting a device or a handle we must remove the link between the two to avoid dangling references. Provide function efi_unlink_dev() for this purpose. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
874490c7ec
commit
16b27b67c5
@ -708,6 +708,7 @@ const char *guid_to_sha_str(const efi_guid_t *guid);
|
|||||||
int algo_to_len(const char *algo);
|
int algo_to_len(const char *algo);
|
||||||
|
|
||||||
int efi_link_dev(efi_handle_t handle, struct udevice *dev);
|
int efi_link_dev(efi_handle_t handle, struct udevice *dev);
|
||||||
|
int efi_unlink_dev(efi_handle_t handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* efi_size_in_pages() - convert size in bytes to size in pages
|
* efi_size_in_pages() - convert size in bytes to size in pages
|
||||||
|
@ -171,3 +171,22 @@ int efi_link_dev(efi_handle_t handle, struct udevice *dev)
|
|||||||
handle->dev = dev;
|
handle->dev = dev;
|
||||||
return dev_tag_set_ptr(dev, DM_TAG_EFI, handle);
|
return dev_tag_set_ptr(dev, DM_TAG_EFI, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* efi_unlink_dev() - unlink udevice and handle
|
||||||
|
*
|
||||||
|
* @handle: EFI handle to unlink
|
||||||
|
*
|
||||||
|
* Return: 0 on success, negative on failure
|
||||||
|
*/
|
||||||
|
int efi_unlink_dev(efi_handle_t handle)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = dev_tag_del(handle->dev, DM_TAG_EFI);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
handle->dev = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user