[PATCH 1/2] console simple: return with a proper error value

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 13 10:57:19 EDT 2012


There can be only one console for console_simple, so
return with -EBUSY when the second gets registered.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/console_simple.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/console_simple.c b/common/console_simple.c
index 49c5b33..7ad88d9 100644
--- a/common/console_simple.c
+++ b/common/console_simple.c
@@ -155,13 +155,15 @@ EXPORT_SYMBOL(ctrlc);
 
 int console_register(struct console_device *newcdev)
 {
-	if (!console) {
-		console = newcdev;
-		console_list.prev = console_list.next = &newcdev->list;
-		newcdev->list.prev = newcdev->list.next = &console_list;
+	if (console)
+		return -EBUSY;
+
+	console = newcdev;
+	console_list.prev = console_list.next = &newcdev->list;
+	newcdev->list.prev = newcdev->list.next = &console_list;
+
+	barebox_banner();
 
-		barebox_banner();
-	}
 	return 0;
 }
 
-- 
1.7.10




More information about the barebox mailing list