Re: [PATCH 2/2] tty: serial: 8250_core: Check that port->line is >=0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux