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 2/2] netconsole: bail out if console_register fails
Date: Fri, 13 Apr 2012 16:57:20 +0200	[thread overview]
Message-ID: <1334329040-1718-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334329040-1718-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/netconsole.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/netconsole.c b/net/netconsole.c
index 2ac3e64..48f2b98 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -174,6 +174,7 @@ static int netconsole_init(void)
 {
 	struct nc_priv *priv;
 	struct console_device *cdev;
+	int ret;
 
 	priv = xzalloc(sizeof(*priv));
 	cdev = &priv->cdev;
@@ -185,7 +186,12 @@ static int netconsole_init(void)
 
 	priv->fifo = kfifo_alloc(1024);
 
-	console_register(cdev);
+	ret = console_register(cdev);
+	if (ret) {
+		printf("netconsole: registering failed with %s\n", strerror(-ret));
+		kfree(priv);
+		return ret;
+	}
 
 	dev_add_param(&cdev->class_dev, "ip", nc_remoteip_set, NULL, 0);
 	dev_add_param(&cdev->class_dev, "port", nc_port_set, NULL, 0);
-- 
1.7.10


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

      parent 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 ` [PATCH 1/2] console simple: return with a proper error value Sascha Hauer
2012-04-13 14:57 ` Sascha Hauer [this message]

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