[PATCH 2/2] netconsole: bail out if console_register fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux