[Concept,04/17] vbe: Propagate probe errors from vbe_get_blk()

Message ID 20260316183050.3855921-5-sjg@u-boot.org
State New
Headers
Series Add automatic memory-leak detection to U-Boot tests |

Commit Message

Simon Glass March 16, 2026, 6:30 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

vbe_get_blk() uses the updated blk_get_devnum_by_uclass_idname()
which now returns the actual error from device_probe(). This replaces
the generic -ENXIO that was returned when the block device could not
be found, making out-of-memory and other probe failures visible to
the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 boot/vbe_common.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
  

Patch

diff --git a/boot/vbe_common.c b/boot/vbe_common.c
index f9368a6a9ab..dbbbac3e96a 100644
--- a/boot/vbe_common.c
+++ b/boot/vbe_common.c
@@ -23,10 +23,11 @@  binman_sym_declare(ulong, u_boot_spl_bss_pad, size);
 
 int vbe_get_blk(const char *storage, struct udevice **blkp)
 {
-	struct blk_desc *desc;
+	struct udevice *blk;
 	char devname[16];
 	const char *end;
 	int devnum;
+	int ret;
 
 	/* First figure out the block device */
 	log_debug("storage=%s\n", storage);
@@ -38,10 +39,10 @@  int vbe_get_blk(const char *storage, struct udevice **blkp)
 	strlcpy(devname, storage, end - storage + 1);
 	log_debug("dev=%s, %x\n", devname, devnum);
 
-	desc = blk_get_dev(devname, devnum);
-	if (!desc)
-		return log_msg_ret("get", -ENXIO);
-	*blkp = desc->bdev;
+	ret = blk_get_devnum_by_uclass_idname(devname, devnum, &blk);
+	if (ret)
+		return log_msg_ret("get", ret);
+	*blkp = blk;
 
 	return 0;
 }