[PATCH v5 04/17] menu: menu_get_choice() return -ENOENT if menu item is empty
Masahisa Kojima
masahisa.kojima at linaro.org
Thu Apr 28 10:09:37 CEST 2022
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 <masahisa.kojima at linaro.org>
---
Newly created in v5
common/menu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/menu.c b/common/menu.c
index b577d80b4f..4118c6dc3c 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 == 0)
+ return -ENOENT;
+
if (!m->prompt)
return menu_default_choice(m, choice);
--
2.17.1
More information about the U-Boot
mailing list