On Thu, Mar 13, 2025 at 04:45:26PM -0400, Frank Li wrote: > On Thu, Mar 13, 2025 at 02:22:54PM -0500, Bjorn Helgaas wrote: > > On Thu, Mar 13, 2025 at 11:38:40AM -0400, Frank Li wrote: > > > Move devm_pci_alloc_host_bridge() to the beginning of dw_pcie_host_init(). > > > Since devm_pci_alloc_host_bridge() is common code that doesn't depend on > > > any DWC resource, moving it earlier improves code logic and readability. > > > > > > Signed-off-by: Frank Li <Frank.Li@xxxxxxx> > > > --- > > > drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------ > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > > > index c57831902686e..52a441662cabe 100644 > > > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > > > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > > > @@ -452,6 +452,12 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) > > > > > > raw_spin_lock_init(&pp->lock); > > > > > > + bridge = devm_pci_alloc_host_bridge(dev, 0); > > > + if (!bridge) > > > + return bridge; > > > > This returns NULL (0) where it previously returned -ENOMEM. Callers > > interpret zero as "success", so I think it should stil return -ENOMEM. > > It should be -ENOMEM. Sorry for that. Strange, not sure what happen when > I copy/past code. > > Do you need respin it or you can fix it? I fixed it locally. But you should fix it, too, in case we do another spin for other reasons. > > I tentatively changed it back to -ENOMEM locally, let me know if > > that's wrong. > > > > > + pp->bridge = bridge; > > > +