From: Masahisa Kojima Date: Thu, 28 Apr 2022 08:09:37 +0000 (+0900) Subject: menu: menu_get_choice() return -ENOENT if menu item is empty X-Git-Tag: baikal/mips/sdk5.9~3^2~65^2~5 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=ffb6fe3deec20d1c40c5e04babe01041e8639110;p=uboot.git menu: menu_get_choice() return -ENOENT if menu item is empty menu_get_choice() needs to handle the case that menu item is empty. In this case, menu_get_choice() returns -ENOENT. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt Signed-off-by: Heinrich Schuchardt --- diff --git a/common/menu.c b/common/menu.c index b577d80b4f..f5fc6930a2 100644 --- a/common/menu.c +++ b/common/menu.c @@ -271,6 +271,9 @@ int menu_get_choice(struct menu *m, void **choice) if (!m || !choice) return -EINVAL; + if (!m->item_cnt) + return -ENOENT; + if (!m->prompt) return menu_default_choice(m, choice);