aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahisa Kojima <masahisa.kojima@linaro.org>2024-01-19 09:45:46 +0900
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2024-01-21 11:24:24 +0100
commit2c98f7435cc5edb2a0b96e9f398c0b7f084e83cd (patch)
tree28b304123b9836b17e7e3d22fe0f921d8dcb5963
parent0351b659dd0283062d91ab0dd752887bedd53278 (diff)
downloadu-boot-2c98f7435cc5edb2a0b96e9f398c0b7f084e83cd.zip
u-boot-2c98f7435cc5edb2a0b96e9f398c0b7f084e83cd.tar.gz
u-boot-2c98f7435cc5edb2a0b96e9f398c0b7f084e83cd.tar.bz2
efi_loader: return immediately in UCLASS_EFI_LOADER removal
In case of UCLASS_EFI_LOADER, EFI handles are managed by EFI application/driver, we must not delete EFI handles. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r--lib/efi_loader/efi_disk.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index e2edc69..b1739d9 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -731,8 +731,14 @@ int efi_disk_remove(void *ctx, struct event *event)
switch (id) {
case UCLASS_BLK:
desc = dev_get_uclass_plat(dev);
- if (desc && desc->uclass_id != UCLASS_EFI_LOADER)
- diskobj = (struct efi_disk_obj *)handle;
+ if (desc && desc->uclass_id == UCLASS_EFI_LOADER)
+ /*
+ * EFI application/driver manages the EFI handle,
+ * no need to delete EFI handle.
+ */
+ return 0;
+
+ diskobj = (struct efi_disk_obj *)handle;
break;
case UCLASS_PARTITION:
diskobj = (struct efi_disk_obj *)handle;
@@ -744,10 +750,8 @@ int efi_disk_remove(void *ctx, struct event *event)
return 0;
}
- if (diskobj) {
- dp = diskobj->dp;
- volume = diskobj->volume;
- }
+ dp = diskobj->dp;
+ volume = diskobj->volume;
ret = efi_delete_handle(handle);
/* Do not delete DM device if there are still EFI drivers attached. */