diff options
author | Caleb Connolly <caleb.connolly@linaro.org> | 2024-01-04 16:03:35 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-01-18 12:18:48 -0500 |
commit | 9d92c418acfb7576e12e2bd53fed294bb9543724 (patch) | |
tree | f25eaefcd963ddc0e0ab9260e392944328cfb29c /boot | |
parent | f7cca7ccc5117eaafcc2bde91ad1bed6fee7cfc3 (diff) | |
download | u-boot-9d92c418acfb7576e12e2bd53fed294bb9543724.zip u-boot-9d92c418acfb7576e12e2bd53fed294bb9543724.tar.gz u-boot-9d92c418acfb7576e12e2bd53fed294bb9543724.tar.bz2 |
bootdev: avoid infinite probe loop
Sometimes, when only one bootdev is available, and it fails to probe, we
end up in an infinite loop calling probe() on the same device over and
over. With only debug level log output.
Break the loop if we fail to probe the same device twice in a row, and
promote the probe failure message to log_warning().
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/bootdev-uclass.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 4926a50..35afb93 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -632,7 +632,7 @@ int bootdev_next_label(struct bootflow_iter *iter, struct udevice **devp, int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) { - struct udevice *dev = *devp; + struct udevice *dev = *devp, *last_dev = NULL; bool found; int ret; @@ -682,9 +682,19 @@ int bootdev_next_prio(struct bootflow_iter *iter, struct udevice **devp) } } else { ret = device_probe(dev); + if (!ret) + last_dev = dev; if (ret) { - log_debug("Device '%s' failed to probe\n", + log_warning("Device '%s' failed to probe\n", dev->name); + if (last_dev == dev) { + /* + * We have already tried this device + * and it failed to probe. Give up. + */ + return log_msg_ret("probe", ret); + } + last_dev = dev; dev = NULL; } } |