Hi Weijie,

On 2026-05-22T02:40:01, Weijie Gao <[email protected]> wrote:
> bootmenu: fix incorrect menu quitting logic
>
> The last entry of bootmenu is always set for exitting the menu, and
> its command is set to an empty string.
>
> When user selects to quit the menu, bootmenu will try to run this
> empty command. However run_command() with empty cmd string will
> return failure, and the return value will be overridden to
> BOOTMENU_RET_FAIL, not the expected BOOTMENU_RET_QUIT.
>
> This patch adds a default success value to the cmd_ret variable, and
> add make sure run_command() be called only when menu command is not
> empty.
>
> Signed-off-by: Weijie Gao <[email protected]>
>
> cmd/bootmenu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

> diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
> @@ -526,7 +526,7 @@ static void handle_uefi_bootnext(void)
>   */
>  static enum bootmenu_ret bootmenu_show(int uefi, int delay)
>  {
> -     int cmd_ret;
> +     int cmd_ret = CMD_RET_SUCCESS;

Nice catch!

> bootmenu: fix incorrect menu quitting logic
>
> The last entry of bootmenu is always set for exitting the menu, and
> its command is set to an empty string.

'exitting' should be 'exiting', and 'and add make sure run_command()
be called only when menu command is not empty' should read 'and makes
sure run_command() is called only when the menu command is not empty'.

With those:

Reviewed-by: Simon Glass <[email protected]>

Regards,
Simon

Reply via email to