lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 12 Dec 2022 10:29:31 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Tharunkumar.Pasumarthi@...rochip.com
Cc:     Kumaravel.Thiagarajan@...rochip.com, linux-kernel@...r.kernel.org,
        linux-serial@...r.kernel.org, gregkh@...uxfoundation.org,
        jirislaby@...nel.org, ilpo.jarvinen@...ux.intel.com,
        macro@...am.me.uk, cang1@...e.co.uk, colin.i.king@...il.com,
        phil.edworthy@...esas.com, biju.das.jz@...renesas.com,
        geert+renesas@...der.be, lukas@...ner.de,
        u.kleine-koenig@...gutronix.de, wander@...hat.com,
        etremblay@...tech-controls.com, jk@...abs.org,
        UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH v8 tty-next 2/4] serial: 8250_pci1xxxx: Add driver for
 quad-uart support

On Mon, Dec 12, 2022 at 07:16:55AM +0000, Tharunkumar.Pasumarthi@...rochip.com wrote:
> > From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Sent: Sunday, December 11, 2022 2:45 AM
> > To: Kumaravel Thiagarajan - I21417
> > <Kumaravel.Thiagarajan@...rochip.com>

...

> > > +             4,/* PCI1p3 */
> > > +     };
> > 
> > If you move this outside of the function you may use static_assert(), see
> > below why.
> 
> If you move this outside of the function -> Do you suggest to move the array outside
> the function

Yes.

> and make it global?

I don't get this, sorry.
The array is already global, only name is scoped inside the certain function.

...

> >         if (subsys_dev <= ARRAY_SIZE(max_port))
> >                 return max_port[subsys_dev];
> > 
> > (in this case you can make sure it is the same as the above using
> > static_assert(), so it won't compile otherwise)
> 
> I am not getting this. You suggest doing something like this:
> static_assert(subsys_dev <= ARRAY_SIZE(max_port)) ?

No, you need to compare ARRAY_SIZE() to the macro that you removed from
the context here.

...

> > > +     priv->nr = nr_ports;
> > > +     pci_set_master(pdev);
> > > +     max_vec_reqd = pci1xxxx_get_max_port(subsys_dev);
> > 
> > The above needs a bit of reshuffling and perhaps a blank line or lines.
> > Make it ordered and grouped more logically.
> 
> Okay. I will do something like this:
> 	pci_set_master(pdev);
> 	<NL>
> 	priv->pdev = pdev;
> 	priv->nr = nr_ports;
> 	<NL>

> 	subsys_dev = priv->pdev->subsystem_device;

Almost good, but why priv is still here?

> 	max_vec_reqd = pci1xxxx_get_max_port(subsys_dev);
> 	<NL>
> 	num_vectors = pci_alloc_irq_vectors(pdev, 1, max_vec_reqd, PCI_IRQ_ALL_TYPES);
> 	if (num_vectors < 0)
> 		return num_vectors;

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ