diff options
author | Tom Rini <trini@konsulko.com> | 2019-07-24 14:15:51 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-24 14:15:51 -0400 |
commit | a9aa4c5700c68c070d63a391b51ea8d341b6e8a6 (patch) | |
tree | 974a824402b489cfec95f2ca8ec5bd9fef71a8bc /common/menu.c | |
parent | ef783259d6a558d31385039fa0def211fa7ad032 (diff) | |
parent | e21e3ffdd18b88a12d98f6ae985fd5d334b9cec9 (diff) |
Merge branch '2019-07-24-master-imports'
- Various Android related changes including A/B update and BCB updates
- Assorted minor fixes
Diffstat (limited to 'common/menu.c')
-rw-r--r-- | common/menu.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/menu.c b/common/menu.c index 0f0a29ac2e..7b66d199a9 100644 --- a/common/menu.c +++ b/common/menu.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2010-2011 Calxeda, Inc. + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. */ #include <common.h> @@ -39,6 +40,7 @@ struct menu { char *(*item_choice)(void *); void *item_choice_data; struct list_head items; + int item_cnt; }; /* @@ -271,7 +273,7 @@ int menu_get_choice(struct menu *m, void **choice) if (!m || !choice) return -EINVAL; - if (!m->prompt) + if (!m->prompt || m->item_cnt == 1) return menu_default_choice(m, choice); return menu_interactive_choice(m, choice); @@ -323,6 +325,7 @@ int menu_item_add(struct menu *m, char *item_key, void *item_data) item->data = item_data; list_add_tail(&item->list, &m->items); + m->item_cnt++; return 1; } @@ -374,6 +377,7 @@ struct menu *menu_create(char *title, int timeout, int prompt, m->item_data_print = item_data_print; m->item_choice = item_choice; m->item_choice_data = item_choice_data; + m->item_cnt = 0; if (title) { m->title = strdup(title); |