Commit 3c59958d authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54178fe6
...@@ -1653,16 +1653,16 @@ static int serial_omap_probe(struct platform_device *pdev) ...@@ -1653,16 +1653,16 @@ static int serial_omap_probe(struct platform_device *pdev)
up->port.ops = &serial_omap_pops; up->port.ops = &serial_omap_pops;
if (pdev->dev.of_node) 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 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", dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
up->port.line); ret);
ret = -ENODEV;
goto err_port_line; goto err_port_line;
} }
up->port.line = ret;
if (up->port.line >= OMAP_MAX_HSUART_PORTS) { if (up->port.line >= OMAP_MAX_HSUART_PORTS) {
dev_err(&pdev->dev, "uart ID %d > MAX %d.\n", up->port.line, dev_err(&pdev->dev, "uart ID %d > MAX %d.\n", up->port.line,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment