Re: [PATCH v9 tty-next 2/4] serial: 8250_pci1xxxx: Add driver for quad-uart support

From: Andy Shevchenko
Date: Thu Dec 15 2022 - 12:44:35 EST


On Thu, Dec 15, 2022 at 07:42:32PM +0200, Andy Shevchenko wrote:
> On Fri, Dec 16, 2022 at 10:56:54AM +0530, Kumaravel Thiagarajan wrote:

...

> > +static unsigned int pci1xxxx_get_max_port(int subsys_dev)
> > +{
> > + int i = 0;
>
> What the point to assign this one?
>
> Actually, better is
>
> unsigned int = MAX_PORTS;
>
> > + if (subsys_dev < ARRAY_SIZE(logical_to_physical_port_idx))
>
> > + for (i = MAX_PORTS - 1; i >= 0; i--)
>
> while (i--) {
>
> > + if (logical_to_physical_port_idx[subsys_dev][i] != -1)
> > + return logical_to_physical_port_idx[subsys_dev][i] + 1;
>
> }
>
> (Note missinng {} in the above code. Does checkpatch complain on this?)
>
> > + if (subsys_dev != PCI_SUBDEVICE_ID_EFAR_PCI11414)
> > + return 1;
> > +
> > + return 4;

Also you can consider the positive check here:

if (subsys_dev == PCI_SUBDEVICE_ID_EFAR_PCI11414)
return 4;

return 1;

> > +}

--
With Best Regards,
Andy Shevchenko