On error paths make sure that the pci_host_bridge struct is freed. Signed-off-by: Djalal Harouni <tixxdz@xxxxxxxxxx> --- On top of linux-next. drivers/pci/probe.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 23cdfac..483566c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1771,15 +1771,13 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->dev.release = pci_release_host_bridge_dev; dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus); error = pcibios_root_bridge_prepare(bridge); - if (error) { - kfree(bridge); - goto err_out; - } + if (error) + goto host_bridge_err; error = device_register(&bridge->dev); if (error) { put_device(&bridge->dev); - goto err_out; + goto host_bridge_err; } b->bridge = get_device(&bridge->dev); device_enable_async_suspend(b->bridge); @@ -1836,6 +1834,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, class_dev_reg_err: put_device(&bridge->dev); device_unregister(&bridge->dev); +host_bridge_err: + kfree(bridge); err_out: kfree(b); return NULL; -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html