diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2014-11-12 10:28:34 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-25 17:06:39 -0800 |
commit | 3c59958d5868f77741930402dfcb27e9dc8968d2 (patch) | |
tree | 0eb341aa885ad19ef7fdfce3fa79bea8249a9cdf | |
parent | 54178fe6b3443249ec2dcd6eec9f2c3ebcdc3142 (diff) | |
download | linux-3c59958d5868f77741930402dfcb27e9dc8968d2.tar.gz linux-3c59958d5868f77741930402dfcb27e9dc8968d2.tar.bz2 linux-3c59958d5868f77741930402dfcb27e9dc8968d2.zip |
tty: serial: omap_serial: 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) {
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>
-rw-r--r-- | drivers/tty/serial/omap-serial.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index e0bec06a5f60..435478a245d3 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -1653,16 +1653,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; if (up->port.line >= OMAP_MAX_HSUART_PORTS) { dev_err(&pdev->dev, "uart ID %d > MAX %d.\n", up->port.line, |