From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 08 Feb 2017 07:23:24 +0000 Subject: [patch] serdev: ttyport: check whether tty_init_dev() fails Message-Id: <20170208072324.GA12916@mwanda> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Rob Herring Cc: Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org 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 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;