Skip to content

Commit fd2036f

Browse files
robherringgregkh
authored andcommitted
PCI: Fix pci_register_host_bridge() device_register() error handling
[ Upstream commit 1b54ae8 ] If device_register() has an error, we should bail out of pci_register_host_bridge() rather than continuing on. Fixes: 37d6a0a ("PCI: Add pci_register_host_bridge() interface") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 91aee01 commit fd2036f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/pci/probe.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,9 +909,10 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
909909
goto free;
910910

911911
err = device_register(&bridge->dev);
912-
if (err)
912+
if (err) {
913913
put_device(&bridge->dev);
914-
914+
goto free;
915+
}
915916
bus->bridge = get_device(&bridge->dev);
916917
device_enable_async_suspend(bus->bridge);
917918
pci_set_bus_of_node(bus);

0 commit comments

Comments
 (0)