From: Jens Taprogge Date: Wed, 12 Sep 2012 12:55:40 +0000 (+0200) Subject: Staging: ipack/devices/ipoctal: Check tty_register_device return value. X-Git-Tag: firefly_0821_release~3680^2~1977^2~267 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2afb41d9d30d33504c47a5dda3eeade692f388dc;p=firefly-linux-kernel-4.4.55.git Staging: ipack/devices/ipoctal: Check tty_register_device return value. Signed-off-by: Jens Taprogge Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c index b84ab5eb4b11..737127033cff 100644 --- a/drivers/staging/ipack/devices/ipoctal.c +++ b/drivers/staging/ipack/devices/ipoctal.c @@ -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