aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAKASHI Takahiro2022-04-19 10:05:15 +0900
committerHeinrich Schuchardt2022-04-23 22:05:41 +0200
commita3cb34e9b7506dec1e5f55279f17a12eded86c48 (patch)
tree961afbd0b6633facc5ab34b98bc409584e1c5e6b /lib
parentb406eb04c360b4842a02bcfedd9bbee015c3d127 (diff)
efi_loader: disk: not delete BLK device for BLK(IF_TYPE_EFI_LOADER) devices
When we create an efi_disk device with an UEFI application using driver binding protocol, the 'efi_driver' framework tries to create a corresponding block device(UCLASS_BLK/IF_TYPE_EFI). This will lead to calling a PROBE callback, efi_disk_probe(). In this case, however, we don't need to create another "efi_disk" device as we already have this device instance. So we should avoid recursively invoke further processing in the callback function. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_disk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 940390ac8bc..34bb662e9cc 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -648,13 +648,17 @@ static int efi_disk_probe(void *ctx, struct event *event)
static int efi_disk_delete_raw(struct udevice *dev)
{
efi_handle_t handle;
+ struct blk_desc *desc;
struct efi_disk_obj *diskobj;
if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle))
return -1;
- diskobj = container_of(handle, struct efi_disk_obj, header);
- efi_free_pool(diskobj->dp);
+ desc = dev_get_uclass_plat(dev);
+ if (desc->if_type != IF_TYPE_EFI_LOADER) {
+ diskobj = container_of(handle, struct efi_disk_obj, header);
+ efi_free_pool(diskobj->dp);
+ }
efi_delete_handle(handle);
dev_tag_del(dev, DM_TAG_EFI);