summaryrefslogtreecommitdiffstats
path: root/common/console_simple.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-01-26 14:16:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-13 16:56:15 +0200
commitd13f42dd3cdb762b9f0ff391e96988f5835b87c1 (patch)
tree41b2a80ff3b7f6f0794981521c19ecdbd9930e39 /common/console_simple.c
parentc406f591292ccc2af583445c0a8b5f9ade0310e2 (diff)
downloadbarebox-d13f42dd3cdb762b9f0ff391e96988f5835b87c1.tar.gz
console simple: return with a proper error value
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@pengutronix.de>
Diffstat (limited to 'common/console_simple.c')
-rw-r--r--common/console_simple.c14
1 files 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;
}