From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-serial@vger.kernel.org
Cc: dan.carpenter@oracle.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 2/2] tty: serial: omap_serial: line is unsigned, don't check < 0
Date: Wed, 12 Nov 2014 10:28:34 +0100 [thread overview]
Message-ID: <1415784514-26649-2-git-send-email-bigeasy@linutronix.de> (raw)
In-Reply-To: <1415784514-26649-1-git-send-email-bigeasy@linutronix.de>
Dan Carpenter reported:
|drivers/tty/serial/8250/8250_omap.c:1025 omap8250_probe()
|warn: unsigned 'up.port.line' is never less than zero.
|1025 if (up.port.line < 0) {
Since of_alias_get_id() and pdev->id can get negative I check for the
error via ret variable.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/tty/serial/omap-serial.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6cda5cd8b513..9401d2f9c119 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1682,16 +1682,16 @@ static int serial_omap_probe(struct platform_device *pdev)
up->port.ops = &serial_omap_pops;
if (pdev->dev.of_node)
- up->port.line = of_alias_get_id(pdev->dev.of_node, "serial");
+ ret = of_alias_get_id(pdev->dev.of_node, "serial");
else
- up->port.line = pdev->id;
+ ret = pdev->id;
- if (up->port.line < 0) {
+ if (ret < 0) {
dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
- up->port.line);
- ret = -ENODEV;
+ ret);
goto err_port_line;
}
+ up->port.line = ret;
ret = serial_omap_probe_rs485(up, pdev->dev.of_node);
if (ret < 0)
--
2.1.3
next prev parent reply other threads:[~2014-11-12 9:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 8:48 tty: serial: Add 8250-core based omap driver Dan Carpenter
2014-11-12 9:28 ` [PATCH 1/2] tty: serial: 8250: omap: line is unsigned, don't check < 0 Sebastian Andrzej Siewior
2014-11-12 9:28 ` Sebastian Andrzej Siewior [this message]
2014-11-25 18:08 ` Sebastian Andrzej Siewior
2014-11-25 19:27 ` Greg Kroah-Hartman
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=1415784514-26649-2-git-send-email-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-serial@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).