[PATCH 11/18] bootentries: Move menu display string allocation to bootentries_alloc()

Sascha Hauer s.hauer at pengutronix.de
Fri Jul 22 05:44:25 PDT 2016


bootentries_alloc() is the place where the struct bootentries container
is allocated, so allocate the menu entry there aswell.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/boot.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/commands/boot.c b/commands/boot.c
index 1ae2745..f193c93 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -50,8 +50,10 @@ static struct bootentries *bootentries_alloc(void)
 	bootentries = xzalloc(sizeof(*bootentries));
 	INIT_LIST_HEAD(&bootentries->entries);
 
-	if (IS_ENABLED(CONFIG_MENU))
+	if (IS_ENABLED(CONFIG_MENU)) {
 		bootentries->menu = menu_alloc();
+		bootentries->menu->display = basprintf("boot");
+	}
 
 	return bootentries;
 }
@@ -294,9 +296,6 @@ static struct bootentries *bootentries_collect(char *entries[], int num_entries)
 
 	bootentries = bootentries_alloc();
 
-	if (IS_ENABLED(CONFIG_MENU))
-		bootentries->menu->display = basprintf("boot");
-
 	if (!num_entries)
 		bootscript_scan_path(bootentries, "/env/boot");
 
-- 
2.8.1




More information about the barebox mailing list