Staging: ipack/devices/ipoctal: Check tty_register_device return value.
authorJens Taprogge <jens.taprogge@taprogge.org>
Wed, 12 Sep 2012 12:55:40 +0000 (14:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Sep 2012 16:56:02 +0000 (09:56 -0700)
Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ipack/devices/ipoctal.c

index b84ab5eb4b11a0c739b2fd994fcf80a2d4890ea4..737127033cffeb453ca8d1a4ef1b5a1192a8780e 100644 (file)
@@ -437,6 +437,8 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
        ipoctal->tty_drv = tty;
 
        for (i = 0; i < NR_CHANNELS; i++) {
+               struct device *tty_dev;
+
                channel = &ipoctal->channel[i];
                tty_port_init(&channel->tty_port);
                tty_port_alloc_xmit_buf(&channel->tty_port);
@@ -450,7 +452,11 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
                channel->pointer_read = 0;
                channel->pointer_write = 0;
                channel->nb_bytes = 0;
-               tty_register_device(tty, i, NULL);
+               tty_dev = tty_register_device(tty, i, NULL);
+               if (IS_ERR(tty_dev)) {
+                       dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n");
+                       continue;
+               }
 
                /*
                 * Enable again the RX. TX will be enabled when