]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootstd: Probe the block device before use
authorSimon Glass <sjg@chromium.org>
Sat, 28 Jan 2023 22:00:19 +0000 (15:00 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 6 Feb 2023 18:04:53 +0000 (13:04 -0500)
In some cases the block device is obtained but is not probed, since it
is a sibling of the bootdev. Make sure it is probed, so it can be used
without any trouble.

This fixes a bug with virtio, where the device is accessed before it has
been set up by the virtio uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 201417d700a ("bootstd: Add the bootdev uclass")
Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
boot/bootdev-uclass.c
boot/bootflow.c

index 99ee08e33530e36365682169643d9083388cea0e..8103a11d1bbf5f00f082edc8f5fd90877e558035 100644 (file)
@@ -309,6 +309,9 @@ int bootdev_get_sibling_blk(struct udevice *dev, struct udevice **blkp)
                if (ret)
                        return log_msg_ret("find", ret);
        }
+       ret = device_probe(blk);
+       if (ret)
+               return log_msg_ret("act", ret);
        *blkp = blk;
 
        return 0;
index dc3f1f0c7315ecb194ea3bbfb7af990f579ca6a4..b8fa37ee2a0ed0f5b82c1d4a2fa9e66e8391d881 100644 (file)
@@ -270,6 +270,10 @@ static int iter_incr(struct bootflow_iter *iter)
                if (ret) {
                        bootflow_iter_set_dev(iter, NULL, 0);
                } else {
+                       /*
+                        * Probe the bootdev. This does not probe any attached
+                        * block device, since they are siblings
+                        */
                        ret = device_probe(dev);
                        log_debug("probe %s %d\n", dev->name, ret);
                        if (!log_msg_ret("probe", ret))