From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Michal Simek <michal.simek@xilinx.com>,
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>,
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: Re: [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0
Date: Fri, 16 Jan 2015 10:00:30 +0100 [thread overview]
Message-ID: <54B8D32E.5000805@linutronix.de> (raw)
In-Reply-To: <d3a26f5ecd44e1415f213e6ee7f33005c1b23f4a.1421333585.git.michal.simek@xilinx.com>
On 01/15/2015 03:55 PM, Michal Simek wrote:
> 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.
This is what I have in 8250_omap to make sure it does not get < 0:
if (pdev->dev.of_node) {
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 {
ret = pdev->id;
}
if (ret < 0) {
dev_err(&pdev->dev, "failed to get alias/pdev id\n");
return ret;
}
up.port.line = ret;
but I didn't think of that others might pass < 0 since it wasn't used
before.
Does the original patch (you noted) break anything as of now? Because
then this patch should go stable.
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>
> 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.
Which second part?
Hmmm. You could use of_alias_get_id(port.dev->of_node, "serial") here,
correct. But I think additionally, since it won't work for the
non-DT devices like pure platform devices.
> ---
> 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
Sebastian
next prev parent reply other threads:[~2015-01-16 9:00 UTC|newest]
Thread overview: 17+ 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 ` [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0 Michal Simek
2015-01-16 9:00 ` Sebastian Andrzej Siewior [this message]
2015-01-16 10:37 ` Michal Simek
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: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 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 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=54B8D32E.5000805@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=alan@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.