summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2014-11-12 09:28:33 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-26 01:06:38 (GMT)
commit54178fe6b3443249ec2dcd6eec9f2c3ebcdc3142 (patch)
treeee6e61dcf95c3f8eac6edb1c01e380bdb1d9b5db /drivers
parent6b1f40cf4840820051d69646af0b6503878cb1bc (diff)
downloadlinux-54178fe6b3443249ec2dcd6eec9f2c3ebcdc3142.tar.xz
tty: serial: 8250: omap: line is unsigned, don't check < 0
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) { I (wrongly) assumed that line is an int and compiler didn't complain nor did sparse. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/8250/8250_omap.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 57a8b12..336602e 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1014,19 +1014,20 @@ static int omap8250_probe(struct platform_device *pdev)
up.port.unthrottle = omap_8250_unthrottle;
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");
+
of_property_read_u32(pdev->dev.of_node, "clock-frequency",
&up.port.uartclk);
priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
} else {
- up.port.line = pdev->id;
+ ret = pdev->id;
}
-
- if (up.port.line < 0) {
- dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
- up.port.line);
- return -ENODEV;
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to get alias/pdev id\n");
+ return ret;
}
+ up.port.line = ret;
+
if (!up.port.uartclk) {
up.port.uartclk = DEFAULT_CLK_SPEED;
dev_warn(&pdev->dev,