Re: [PATCH] PCI: remove type return
From: Bjorn Helgaas
Date: Fri Aug 09 2024 - 14:14:43 EST
On Thu, Aug 08, 2024 at 06:05:54PM -0300, Guilherme Giácomo Simões wrote:
> Bjorn Helgaas <helgaas@xxxxxxxxxx> writes:
> >
> > On Tue, Aug 06, 2024 at 05:54:15PM -0300, Guilherme Giácomo Simões wrote:
> > > Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
> > > > On Sat, 3 Aug 2024, Guilherme Giacomo Simoes wrote:
> > > >
> > > > > I can see that the function pci_hp_add_brigde have a int return
> > > > > propagation.
> > > ...
> >
> > > > The lack of return value checking seems to be on the list in
> > > > pci_hp_add_bridge(). So perhaps the right course of action would be to
> > > > handle return values correctly.
> > >
> > > Ok, so if the right course is for the driver to handle return value,
> > > then this is a
> > > task for the driver developers, because only they know what to do when
> > > pci_hp_add_bridge() doesn't work correctly, right?
> >
> > pci_hp_add_bridge() is only for hotplug drivers, so the list of
> > callers is short and completely under our control. There's plenty of
> > opportunity for improving this. Beyond just the return value, all the
> > callers of pci_hp_add_bridge() should be doing much of the same work
> > that could potentially be factored out.
>
> Okay, then what the action that the drivers must be do when the add
> bridge is failed?
pci_hp_add_bridge() fails when there's no bus number available to
assign to new hot-added devices. When that happens, there's really
nothing the hotplug drivers can do to improve the situation.
pci_hp_add_bridge() already logs a message for one of the failure
cases. It may be that it should also log a message for the other
failure case. The end result is that we can't use the hot-added
devices because there's no space for them in the PCI bus number space,
so we can't address them.
Bjorn