]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootmenu: fix menu API error handling
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Thu, 24 Mar 2022 13:54:33 +0000 (22:54 +0900)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 23 Apr 2022 20:05:34 +0000 (22:05 +0200)
U-Boot menu framework(common/menu.c) returns 1 if it is successful,
returns negative value if it fails.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/bootmenu.c

index 409ef9a8480896232e15e7f8cc32c24ebc3d6d98..d57348727207bfa01382ca318bbdf6a2467c6e36 100644 (file)
@@ -463,7 +463,7 @@ static void bootmenu_show(int delay)
        }
 
        for (iter = bootmenu->first; iter; iter = iter->next) {
-               if (!menu_item_add(menu, iter->key, iter))
+               if (menu_item_add(menu, iter->key, iter) != 1)
                        goto cleanup;
        }
 
@@ -476,7 +476,7 @@ static void bootmenu_show(int delay)
 
        init = 1;
 
-       if (menu_get_choice(menu, &choice)) {
+       if (menu_get_choice(menu, &choice) == 1) {
                iter = choice;
                title = strdup(iter->title);
                command = strdup(iter->command);