lkml.org 
[lkml]   [2021]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/4] serial: 8250_pci: Refactor the loop in pci_ite887x_init()
On Wed, Jul 14, 2021 at 08:57:06AM +0200, Jiri Slaby wrote:
> On 13. 07. 21, 12:40, Andy Shevchenko wrote:
> > The loop can be refactored by using ARRAY_SIZE() instead of NULL terminator.
> > This reduces code base and makes it easier to read and understand.

> > + iobase = request_region(inta_addr[i], ITE_887x_IOSIZE, "ite887x");
>
> Irrelevant whitespace change.
>
> > if (iobase != NULL) {
> > /* write POSIO0R - speed | size | ioport */
> > pci_write_config_dword(dev, ITE_887x_POSIO0,
> > ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
> > ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
> > /* write INTCBAR - ioport */
> > - pci_write_config_dword(dev, ITE_887x_INTCBAR,
> > - inta_addr[i]);
> > + pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]);
>
> detto
>
> > ret = inb(inta_addr[i]);
> > if (ret != 0xff) {
> > /* ioport connected */
> > break;
> > }
> > release_region(iobase->start, ITE_887x_IOSIZE);
> > - iobase = NULL;
> > }
> > - i++;

I believe with Joe's suggestion I can improve entire body of this branch
perhaps in a separate patch. Do you prefer one or two patches?

> > if (!inta_addr[i]) {
>
> OOB access?

Yep, Dan reported the same. Missed during conversion. Will fix.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2021-07-14 14:39    [W:0.028 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site