]> git.baikalelectronics.ru Git - uboot.git/commitdiff
bootstd: Detect empty bootmeth ordering
authorSimon Glass <sjg@chromium.org>
Sat, 30 Jul 2022 21:52:18 +0000 (15:52 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 12 Aug 2022 12:14:24 +0000 (08:14 -0400)
If the ordering produces no entries, this is an error. Report it, so that
the caller doesn't try to continue with a NULL bootmeth.

This fixes a crash in the bootflow_iter test when running with the sandbox
'default' device tree, instead of the required 'test' one.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootmeth-uclass.c

index c040d5f92b2d2d47bf5808da023523fd8f572ff5..b8ba4eca7abd10a96fb33506497e442c07ebc8cb 100644 (file)
@@ -114,6 +114,8 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter)
                }
                count = upto;
        }
+       if (!count)
+               return log_msg_ret("count2", -ENOENT);
 
        iter->method_order = order;
        iter->num_methods = count;