All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] serdev: ttyport: check whether tty_init_dev() fails
Date: Wed, 08 Feb 2017 07:23:24 +0000	[thread overview]
Message-ID: <20170208072324.GA12916@mwanda> (raw)

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>

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;

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] serdev: ttyport: check whether tty_init_dev() fails
Date: Wed, 8 Feb 2017 10:23:24 +0300	[thread overview]
Message-ID: <20170208072324.GA12916@mwanda> (raw)

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>

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;

             reply	other threads:[~2017-02-08  7:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08  7:23 Dan Carpenter [this message]
2017-02-08  7:23 ` [patch] serdev: ttyport: check whether tty_init_dev() fails Dan Carpenter
2017-02-08 13:40 ` Rob Herring
2017-02-08 13:40   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208072324.GA12916@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.