summaryrefslogtreecommitdiff
path: root/boot/bootdev-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-04-24 04:49:49 +0300
committerTom Rini <trini@konsulko.com>2023-04-26 15:43:05 +0300
commit1aabe4ef2b746c9aa76a25787a6aef57a165ca86 (patch)
tree503cf2b631550c04b713f0604e6d854187325d53 /boot/bootdev-uclass.c
parentf9fb57c6917f9172f0393c67463e0b1230726e66 (diff)
downloadu-boot-1aabe4ef2b746c9aa76a25787a6aef57a165ca86.tar.xz
bootstd: Adjust code ordering to work around compiler quirk
At present when debugging is off, bootdev_find_in_blk() sometimes fails to find a valid bootflow, e.g. with virtio. Accessing the 'blk' variable later in the function seems to correct it. Move the 'ret' check before the debug statement and set the block device again aftewards, to work around this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootdev-uclass.c')
-rw-r--r--boot/bootdev-uclass.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index 91087981d2..57d2944647 100644
--- a/boot/bootdev-uclass.c
+++ b/boot/bootdev-uclass.c
@@ -174,6 +174,8 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
} else {
ret = fs_set_blk_dev_with_part(desc, bflow->part);
bflow->state = BOOTFLOWST_PART;
+ if (ret)
+ return log_msg_ret("fs", ret);
/* Use an #ifdef due to info.sys_ind */
#ifdef CONFIG_DOS_PARTITION
@@ -181,8 +183,7 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
blk->name, bflow->part, info.sys_ind,
ret ? -1 : fs_get_type());
#endif
- if (ret)
- return log_msg_ret("fs", ret);
+ bflow->blk = blk;
bflow->state = BOOTFLOWST_FS;
}