From: Simon Glass Date: Sat, 30 Jul 2022 21:52:18 +0000 (-0600) Subject: bootstd: Detect empty bootmeth ordering X-Git-Tag: baikal/mips/sdk5.8.2~5^2~252^2~19 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=4611c81b720dec7291ccd92e9d4066f4a6035065;p=uboot.git bootstd: Detect empty bootmeth ordering 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 --- diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index c040d5f92b..b8ba4eca7a 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -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;