linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: linux-kernel@vger.kernel.org, monstr@monstr.eu
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.cz>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Peter Hurley <peter@hurleysoftware.com>,
	Alan Cox <alan@linux.intel.com>, Tony Lindgren <tony@atomide.com>,
	Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
	Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0
Date: Thu, 15 Jan 2015 15:55:08 +0100	[thread overview]
Message-ID: <d3a26f5ecd44e1415f213e6ee7f33005c1b23f4a.1421333585.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <3293c93689f5d8c684133a9d9952411a201609dc.1421333585.git.michal.simek@xilinx.com>
In-Reply-To: <3293c93689f5d8c684133a9d9952411a201609dc.1421333585.git.michal.simek@xilinx.com>

[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]

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@xilinx.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


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2015-01-15 14:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 14:55 [PATCH 1/2] tty: serial: 8250_core: Remove trailing whitespaces Michal Simek
2015-01-15 14:55 ` Michal Simek [this message]
2015-01-16  9:00   ` [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0 Sebastian Andrzej Siewior
2015-01-16 10:37     ` Michal Simek
2015-01-16 10:51       ` Sebastian Andrzej Siewior
2015-01-16 11:02         ` Michal Simek
2015-01-16 11:33           ` Sebastian Andrzej Siewior
2015-01-30 23:23   ` Greg Kroah-Hartman
2015-02-02  8:09     ` Michal Simek
2015-02-02 10:49       ` Andy Shevchenko
2015-01-30 23:22 ` [PATCH 1/2] tty: serial: 8250_core: Remove trailing whitespaces Greg Kroah-Hartman
2015-02-02  8:08   ` Michal Simek
2015-02-02 18:43     ` 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=d3a26f5ecd44e1415f213e6ee7f33005c1b23f4a.1421333585.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=alan@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=monstr@monstr.eu \
    --cc=peter@hurleysoftware.com \
    --cc=ricardo.ribalda@gmail.com \
    --cc=tony@atomide.com \
    --cc=yoshihiro.yunomae.ez@hitachi.com \
    /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).