[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d3a26f5ecd44e1415f213e6ee7f33005c1b23f4a.1421333585.git.michal.simek@xilinx.com>
Date: Thu, 15 Jan 2015 15:55:08 +0100
From: Michal Simek <michal.simek@...inx.com>
To: linux-kernel@...r.kernel.org, monstr@...str.eu
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-serial@...r.kernel.org, Jiri Slaby <jslaby@...e.cz>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Hurley <peter@...leysoftware.com>,
Alan Cox <alan@...ux.intel.com>,
Tony Lindgren <tony@...mide.com>,
Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@...achi.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ingo Molnar <mingo@...e.hu>
Subject: [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0
This patch should be the part of:
"tty: serial: 8250_core: use the ->line argument as a hint in
serial8250_find_match_or_unused()"
(sha1: 59b3e898ddfc81a65975043b5eb44103cc29ff6e)
port->line can be setup by DT driver to -1 which needs to
be also checked.
Signed-off-by: Michal Simek <michal.simek@...inx.com>
---
I have similar patch to 59b3e898ddfc81a65975043b5eb44103cc29ff6e
in xilinx tree for a while and port->line can be -1.
The second part of this also should be (what other drivers do)
reading aliases via of_alias_get_id() in of_serial.c:of_platform_serial_probe()
which setup port.line.
---
drivers/tty/serial/8250/8250_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 65e52c9109e2..aab765177763 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -3512,7 +3512,8 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
/* try line number first if still available */
i = port->line;
- if (i < nr_uarts && serial8250_ports[i].port.type == PORT_UNKNOWN &&
+ if (i >= 0 && i < nr_uarts &&
+ serial8250_ports[i].port.type == PORT_UNKNOWN &&
serial8250_ports[i].port.iobase == 0)
return &serial8250_ports[i];
/*
--
1.8.2.3
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists