When creating the device path of a block device it has to
comprise the block device itself and should not end at
its parent.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
v3
        new patch
---
 lib/efi_loader/efi_device_path.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 31cdd38773..492a7643e6 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -368,7 +368,14 @@ static unsigned dp_part_size(struct blk_desc *desc, int 
part)
        unsigned dpsize;
 
 #ifdef CONFIG_BLK
-       dpsize = dp_size(desc->bdev->parent);
+       {
+               struct udevice *dev;
+               int ret = blk_find_device(desc->if_type, desc->devnum, &dev);
+
+               if (ret)
+                       dev = desc->bdev->parent;
+               dpsize = dp_size(dev);
+       }
 #else
        dpsize = sizeof(ROOT) + sizeof(struct efi_device_path_usb);
 #endif
@@ -396,7 +403,14 @@ static void *dp_part_fill(void *buf, struct blk_desc 
*desc, int part)
        disk_partition_t info;
 
 #ifdef CONFIG_BLK
-       buf = dp_fill(buf, desc->bdev->parent);
+       {
+               struct udevice *dev;
+               int ret = blk_find_device(desc->if_type, desc->devnum, &dev);
+
+               if (ret)
+                       dev = desc->bdev->parent;
+               buf = dp_fill(buf, dev);
+       }
 #else
        /*
         * We *could* make a more accurate path, by looking at if_type
-- 
2.15.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to