[coreboot] r3216 - trunk/payloads/coreinfo

svn at coreboot.org svn at coreboot.org
Fri Apr 4 18:49:11 CEST 2008


Author: uwe
Date: 2008-04-04 18:49:09 +0200 (Fri, 04 Apr 2008)
New Revision: 3216

Modified:
   trunk/payloads/coreinfo/coreinfo.c
Log:
Fix the case where the user selects no modules in Kconfig at all.
Until now, the build would break, and even if it didn't the ELF would
triple-fault in QEMU.

Signed-off-by: Uwe Hermann <uwe at hermann-uwe.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>



Modified: trunk/payloads/coreinfo/coreinfo.c
===================================================================
--- trunk/payloads/coreinfo/coreinfo.c	2008-04-04 15:02:45 UTC (rev 3215)
+++ trunk/payloads/coreinfo/coreinfo.c	2008-04-04 16:49:09 UTC (rev 3216)
@@ -72,7 +72,8 @@
 	for (i = 0; i < ARRAY_SIZE(modules); i++)
 		ptr += sprintf(ptr, "F%d: %s ", i + 1, modules[i]->name);
 
-	mvprintw(23, 0, menu);
+	if (ARRAY_SIZE(modules) != 0)
+		mvprintw(23, 0, menu);
 
 #ifdef CONFIG_SHOW_DATE_TIME
 	mvprintw(23, 59, "%02d/%02d/20%02d - %02d:%02d:%02d",
@@ -121,6 +122,9 @@
 
 static void redraw_module(void)
 {
+	if (ARRAY_SIZE(modules) == 0)
+		return;
+
 	wclear(modwin);
 	modules[curwin]->redraw(modwin);
 	refresh();
@@ -133,7 +137,8 @@
 	center(0, "coreinfo v0.1");
 
 	print_menu();
-	modules[curwin]->redraw(modwin);
+	if (ARRAY_SIZE(modules) != 0)
+		modules[curwin]->redraw(modwin);
 	refresh();
 
 	while (1) {
@@ -145,14 +150,16 @@
 		if (key >= KEY_F(1) && key <= KEY_F(9)) {
 			unsigned char ch = key - KEY_F(1);
 
-			if (ch < ARRAY_SIZE(modules)) {
+			if (ch <= ARRAY_SIZE(modules)) {
+				if (ch == ARRAY_SIZE(modules))
+					continue;
 				curwin = ch;
 				redraw_module();
 				continue;
 			}
 		}
 
-		if (modules[curwin]->handle)
+		if (ARRAY_SIZE(modules) != 0 && modules[curwin]->handle)
 			if (modules[curwin]->handle(key))
 				redraw_module();
 	}





More information about the coreboot mailing list