mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] console simple: return with a proper error value
Date: Fri, 13 Apr 2012 16:57:19 +0200	[thread overview]
Message-ID: <1334329040-1718-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334329040-1718-1-git-send-email-s.hauer@pengutronix.de>

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>
---
 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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-04-13 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 14:57 console fixes Sascha Hauer
2012-04-13 14:57 ` Sascha Hauer [this message]
2012-04-13 14:57 ` [PATCH 2/2] netconsole: bail out if console_register fails Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334329040-1718-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox