diff options
author | Masahisa Kojima <masahisa.kojima@linaro.org> | 2023-07-03 15:08:45 +0900 |
---|---|---|
committer | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-07-20 09:12:50 +0200 |
commit | 06fc19ca4de943827f5aa026f7aa9c3a05411677 (patch) | |
tree | 1475d4dbe1a3454393e0272f5fe1bb3ebe0bdf5b | |
parent | 21eb7c16ec86e239482386238ea606170ef4e90d (diff) | |
download | u-boot-06fc19ca4de943827f5aa026f7aa9c3a05411677.zip u-boot-06fc19ca4de943827f5aa026f7aa9c3a05411677.tar.gz u-boot-06fc19ca4de943827f5aa026f7aa9c3a05411677.tar.bz2 |
efi_driver: fix duplicate efiblk#0 issue
The devnum value of the blk_desc structure starts from 0,
current efi_bl_create_block_device() function creates
two "efiblk#0" devices for the cases that blk_find_max_devnum()
returns -ENODEV and blk_find_max_devnum() returns 0(one device
found in this case).
This commit uses blk_next_free_devnum() instead of blk_find_max_devnum().
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-rw-r--r-- | lib/efi_driver/efi_block_device.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index add00ee..e3abd90 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -124,10 +124,8 @@ efi_bl_create_block_device(efi_handle_t handle, void *interface) struct efi_block_io *io = interface; struct efi_blk_plat *plat; - devnum = blk_find_max_devnum(UCLASS_EFI_LOADER); - if (devnum == -ENODEV) - devnum = 0; - else if (devnum < 0) + devnum = blk_next_free_devnum(UCLASS_EFI_LOADER); + if (devnum < 0) return EFI_OUT_OF_RESOURCES; name = calloc(1, 18); /* strlen("efiblk#2147483648") + 1 */ |