aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAKASHI Takahiro2022-04-19 10:05:13 +0900
committerHeinrich Schuchardt2022-04-23 22:05:41 +0200
commit3c809dfed757c37b92ff543c8f1c941407bafc2e (patch)
tree6c1354a5a8f195d2131518b529984cb96eb45613 /lib
parenta9bf024b2933bba0e23038892970a18b72dfaeb4 (diff)
efi_loader: disk: not create 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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index d4a0edb458b..037f8594a72 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -604,6 +604,7 @@ static int efi_disk_probe(void *ctx, struct event *event)
{
struct udevice *dev;
enum uclass_id id;
+ struct blk_desc *desc;
struct udevice *child;
int ret;
@@ -614,9 +615,16 @@ static int efi_disk_probe(void *ctx, struct event *event)
if (id != UCLASS_BLK)
return 0;
- ret = efi_disk_create_raw(dev);
- if (ret)
- return -1;
+ /*
+ * avoid creating duplicated objects now that efi_driver
+ * has already created an efi_disk at this moment.
+ */
+ desc = dev_get_uclass_plat(dev);
+ if (desc->if_type != IF_TYPE_EFI_LOADER) {
+ ret = efi_disk_create_raw(dev);
+ if (ret)
+ return -1;
+ }
device_foreach_child(child, dev) {
ret = efi_disk_create_part(child);