[PATCH v2] vbe: Allow probing the VBE bootmeth to fail in OS fixup
authorSimon Glass <sjg@chromium.org>
Thu, 12 Jan 2023 23:48:54 +0000 (16:48 -0700)
committerVagrant Cascadian <vagrant@debian.org>
Wed, 18 Jan 2023 01:57:16 +0000 (01:57 +0000)
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
 Karsten Merker <merker@debian.org>,
 Heinrich Schuchardt <xypron.glpk@gmx.de>
Message-Id: <20230112234854.936325-1-sjg@chromium.org>
Origin: https://patchwork.ozlabs.org/project/uboot/patch/20230112234854.936325-1-sjg@chromium.org/
Bug-Debian: https://bugs.debian.org/1028343

This device is created when there are no bootmeths defined in the device
tree. But it cannot be probed without a device tree node.

For now, ignore a probe failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Karsten Merker <merker@debian.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Fixes: a56f663f0707 ("vbe: Add info about the VBE device to the fwupd node")
Gbp-Pq: Topic riscv64
Gbp-Pq: Name vbe-Allow-probing-the-VBE-bootmeth-to-fail-in-OS-fixup.patch

boot/vbe_simple_os.c

index b2041a95a30c95eb627f5ba5316f9a607e917802..8c641ec07e2d8ed2b324279540e324860c876e9c 100644 (file)
@@ -72,6 +72,18 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event)
                chosen = oftree_path(tree, "/chosen");
                if (!ofnode_valid(chosen))
                        continue;
+
+               ret = device_probe(dev);
+               if (ret) {
+                       /*
+                        * This should become an error when VBE is updated to
+                        * only bind this device when a node exists
+                        */
+                       log_debug("VBE device '%s' failed to probe (err=%d)",
+                                 dev->name, ret);
+                       return 0;
+               }
+
                ret = ofnode_add_subnode(chosen, "fwupd", &node);
                if (ret && ret != -EEXIST)
                        return log_msg_ret("fwu", ret);
@@ -80,10 +92,6 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event)
                if (ret && ret != -EEXIST)
                        return log_msg_ret("dev", ret);
 
-               ret = device_probe(dev);
-               if (ret)
-                       return log_msg_ret("probe", ret);
-
                /* Copy over the vbe properties for fwupd */
                log_debug("Fixing up: %s\n", dev->name);
                ret = ofnode_copy_props(dev_ofnode(dev), subnode);