diff mbox

[U-Boot] pxe: make the first label the implicit default

Message ID 1320671235-9224-1-git-send-email-jason.hobbs@calxeda.com
State Accepted
Delegated to: Wolfgang Denk
Headers show

Commit Message

Jason Hobbs Nov. 7, 2011, 1:07 p.m. UTC
If no default label is specified, but a situation arises where the
default label should be used, treat the first label specified as the
default label.

Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
Cc: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
Cc: Wolfgang Denk <wd@denx.de>
---
 common/cmd_pxe.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

Comments

Wolfgang Denk Dec. 6, 2011, 8:21 p.m. UTC | #1
Dear Jason Hobbs,

In message <1320671235-9224-1-git-send-email-jason.hobbs@calxeda.com> you wrote:
> If no default label is specified, but a situation arises where the
> default label should be used, treat the first label specified as the
> default label.
> 
> Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
> Cc: Ricardo Salveti de Araujo <ricardo.salveti@linaro.org>
> Cc: Wolfgang Denk <wd@denx.de>
> 
> ---
> common/cmd_pxe.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 3efd700..9426f5b 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -1273,10 +1273,21 @@  static void handle_pxe_menu(struct pxe_menu *cfg)
 
 	menu_destroy(m);
 
-	if (err < 1)
-		return;
+	/*
+	 * err == 1 means we got a choice back from menu_get_choice.
+	 *
+	 * err == -ENOENT if the menu was setup to select the default but no
+	 * default was set. in that case, we should continue trying to boot
+	 * labels that haven't been attempted yet.
+	 *
+	 * otherwise, the user interrupted or there was some other error and
+	 * we give up.
+	 */
 
-	label_boot(choice);
+	if (err == 1)
+		label_boot(choice);
+	else if (err != -ENOENT)
+		return;
 
 	boot_unattempted_labels(cfg);
 }