[Concept,03/14] bootstd: Set iter->err before BOOTFLOWIF_ALL early return
Commit Message
From: Simon Glass <sjg@chromium.org>
In bootflow_scan_first(), iter->err is not set before the BOOTFLOWIF_ALL
early return, leaving it at its initial value of 0. This is inconsistent
with bootflow_scan_next() which sets iter->err before the same early
return.
Move the iter->err assignment before the BOOTFLOWIF_ALL check so that
subsequent calls to iter_incr() can correctly see the error from the
previous iteration.
Fixes: 5033e36637af ("bootstd: Add support for bootflows")
Signed-off-by: Simon Glass <sjg@chromium.org>
---
boot/bootflow.c | 2 +-
test/boot/bootflow.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
@@ -655,11 +655,11 @@ int bootflow_scan_first(struct udevice *dev, const char *label,
ret = bootflow_check(iter, bflow);
if (ret) {
log_debug("check - ret=%d\n", ret);
+ iter->err = ret;
if (ret != BF_NO_MORE_PARTS && ret != -ENOSYS) {
if (iter->flags & BOOTFLOWIF_ALL)
return log_msg_ret("all", ret);
}
- iter->err = ret;
bootflow_free(bflow);
ret = bootflow_scan_next(iter, bflow);
if (ret)
@@ -321,6 +321,7 @@ static int bootflow_iter(struct unit_test_state *uts)
ut_asserteq(0, iter.max_part);
ut_asserteq_str("extlinux", iter.method->name);
ut_asserteq(0, bflow.err);
+ ut_asserteq(-EPROTONOSUPPORT, iter.err);
ut_assert(!iter.doing_global);
ut_assert(!iter.have_global);
ut_asserteq(-1, iter.first_glob_method);