From c23bb03465c1107495b90c4b396d37a0bbe90bfc Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Thu, 28 Apr 2022 17:09:36 +0900 Subject: menu: always show the menu regardless of the number of entry To make user aware of the menu entry selection, menu always appears regardless of the number of entry. Signed-off-by: Masahisa Kojima Adjust test/py/tests/test_bootmenu.py Reviewed-by: Heinrich Schuchardt --- common/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/menu.c') diff --git a/common/menu.c b/common/menu.c index 5fb2ffbd06..b577d80b4f 100644 --- a/common/menu.c +++ b/common/menu.c @@ -271,7 +271,7 @@ int menu_get_choice(struct menu *m, void **choice) if (!m || !choice) return -EINVAL; - if (!m->prompt || m->item_cnt == 1) + if (!m->prompt) return menu_default_choice(m, choice); return menu_interactive_choice(m, choice); -- cgit v1.2.3 From 7f67525f99d8158f668af8198cc1d089a3dc4ee8 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Thu, 28 Apr 2022 17:09:37 +0900 Subject: 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 --- common/menu.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common/menu.c') 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); -- cgit v1.2.3