diff options
author | Rob Herring <robh@kernel.org> | 2020-05-13 17:38:58 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-05-14 16:36:19 -0500 |
commit | 1b54ae8327a4d630111c8d88ba7906483ec6010b (patch) | |
tree | 758ad9838fd8534e8e3a88ff3d380aec3b89bc4c | |
parent | 8f3d9f354286745c751374f5f1fcafee6b3f3136 (diff) | |
download | linux-1b54ae8327a4d630111c8d88ba7906483ec6010b.tar.bz2 |
PCI: Fix pci_register_host_bridge() device_register() error handling
If device_register() has an error, we should bail out of
pci_register_host_bridge() rather than continuing on.
Fixes: 37d6a0a6f470 ("PCI: Add pci_register_host_bridge() interface")
Link: https://lore.kernel.org/r/20200513223859.11295-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | drivers/pci/probe.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 77b8a145c39b..e21dc71b1907 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -909,9 +909,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) goto free; err = device_register(&bridge->dev); - if (err) + if (err) { put_device(&bridge->dev); - + goto free; + } bus->bridge = get_device(&bridge->dev); device_enable_async_suspend(bus->bridge); pci_set_bus_of_node(bus); |