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]
Message-ID: <CAMRc=McBpqP=qSbxDGcreTcktq_0vQH_PrtQS0V=Mw3w-_Zmwg@mail.gmail.com>
Date: Sat, 6 Jul 2024 19:12:48 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Lukas Wunner <lukas@...ner.de>
Cc: Bert Karwatzki <spasswolf@....de>, Bartosz Golaszewski <bartosz.golaszewski@...aro.org>, 
	caleb.connolly@...aro.org, bhelgaas@...gle.com, amit.pundir@...aro.org, 
	neil.armstrong@...aro.org, linux-kernel@...r.kernel.org, 
	linux-pci@...r.kernel.org
Subject: Re: [PATCH] pci: bus: only call of_platform_populate() if CONFIG_OF
 is defined

On Sat, Jul 6, 2024 at 10:43 AM Lukas Wunner <lukas@...ner.de> wrote:
>
> On Wed, Jul 03, 2024 at 11:32:05AM +0200, Bartosz Golaszewski wrote:
> > On Wed, Jul 3, 2024 at 11:15 AM Bert Karwatzki <spasswolf@....de> wrote:
> > > If of_platform_populate() is called when CONFIG_OF is not defined this
> > > leads to spurious error messages of the following type:
> > >  pci 0000:00:01.1: failed to populate child OF nodes (-19)
> > >  pci 0000:00:02.1: failed to populate child OF nodes (-19)
> > >
> > > Fixes: 8fb18619d910 ("PCI/pwrctl: Create platform devices for child OF nodes of the port node")
> > > Signed-off-by: Bert Karwatzki <spasswolf@....de>
> > > ---
> > >  drivers/pci/bus.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> > > index e4735428814d..b363010664cd 100644
> > > --- a/drivers/pci/bus.c
> > > +++ b/drivers/pci/bus.c
> > > @@ -350,6 +350,7 @@ void pci_bus_add_device(struct pci_dev *dev)
> > >
> > >         pci_dev_assign_added(dev, true);
> > >
> > > +#ifdef CONFIG_OF
> > >         if (pci_is_bridge(dev)) {
>
> Per section 21 of Documentation/process/coding-style.rst,
> IS_ENABLED() is strongly preferred to #ifdef.
>
>
> > There's a better (less ifdeffery) fix on the list that I'll pick up
> > later today[1].
> >
> > [1] https://lore.kernel.org/lkml/20240702180839.71491-1-superm1@kernel.org/T/
>
> That other fix doesn't feel very robust as it depends on
> of_platform_populate() never returning -ENODEV in the
> CONFIG_OF=y case.
>

If we even have to play these ifdef games then the stubs for
of_platform_populate() are broken and should probably return 0 with
!OF as otherwise the stubs themselves are useless.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ