From 10d258c51869916347adce4312e6fe41fa5144ad Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 8 Feb 2017 10:23:24 +0300 Subject: 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 Acked-by: Rob Herring Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serdev/serdev-ttyport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c index 683320b81a2b..d05393594f15 100644 --- a/drivers/tty/serdev/serdev-ttyport.c +++ b/drivers/tty/serdev/serdev-ttyport.c @@ -97,6 +97,8 @@ static int ttyport_open(struct serdev_controller *ctrl) struct ktermios ktermios; tty = tty_init_dev(serport->tty_drv, serport->tty_idx); + if (IS_ERR(tty)) + return PTR_ERR(tty); serport->tty = tty; serport->port->client_ops = &client_ops; -- cgit v1.2.3