lkml.org 
[lkml]   [2015]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0
Hi,

On 01/16/2015 10:00 AM, Sebastian Andrzej Siewior wrote:
> 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.

Origin patch looks good to me but this checking will be good to add.
Are you using of_serial.c because I didn't find any of_alias_get_id call
for 8250?

Your logic here is a little bit different than I have in my tree.
(Some sort of pl011 solution). You don't need to failed if you port.line is
below 0 but if you are not able to read aliases port enumeration
may be unpredictable.

Thanks,
Michal






\
 
 \ /
  Last update: 2015-01-16 12:01    [W:0.196 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site