Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serdev: ttyport: check whether tty_init_dev() fails

My static checker complains that we don't have any error handling here.
It's simple enough to add it.

Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Greg Kroah-Hartman
10d258c5 80cd94e7

+2
+2
drivers/tty/serdev/serdev-ttyport.c
··· 97 97 struct ktermios ktermios; 98 98 99 99 tty = tty_init_dev(serport->tty_drv, serport->tty_idx); 100 + if (IS_ERR(tty)) 101 + return PTR_ERR(tty); 100 102 serport->tty = tty; 101 103 102 104 serport->port->client_ops = &client_ops;