diff mbox series

[v4,01/11] bootmenu: fix menu API error handling

Message ID 20220324135443.1571-2-masahisa.kojima@linaro.org
State Accepted
Commit 990f6636eae1718b785a39c300f466fd41985c55
Headers show
Series enable menu-driven boot device selection | expand

Commit Message

Masahisa Kojima March 24, 2022, 1:54 p.m. UTC
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>
---
Newly added in v4

 cmd/bootmenu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ilias Apalodimas March 30, 2022, 8:55 a.m. UTC | #1
On Thu, Mar 24, 2022 at 10:54:33PM +0900, Masahisa Kojima wrote:
> 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>
> ---
> Newly added in v4
> 
>  cmd/bootmenu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> index 409ef9a848..d573487272 100644
> --- a/cmd/bootmenu.c
> +++ b/cmd/bootmenu.c
> @@ -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);
> -- 
> 2.17.1
> 
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 409ef9a848..d573487272 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -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);