Commit f72e1112 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/deletion' into next

* pci/deletion:
  PCI/portdrv: Remove extra get_device()/put_device() for pcie_device
  PCI/portdrv: Add put_device() after device_register() failure
  PCI/portdrv: Cleanup error paths
parents 9dc1d43f e75f34ce
...@@ -344,11 +344,12 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq) ...@@ -344,11 +344,12 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
device_enable_async_suspend(device); device_enable_async_suspend(device);
retval = device_register(device); retval = device_register(device);
if (retval) if (retval) {
kfree(pcie); put_device(device);
else return retval;
get_device(device); }
return retval;
return 0;
} }
/** /**
...@@ -454,10 +455,8 @@ int pcie_port_device_resume(struct device *dev) ...@@ -454,10 +455,8 @@ int pcie_port_device_resume(struct device *dev)
static int remove_iter(struct device *dev, void *data) static int remove_iter(struct device *dev, void *data)
{ {
if (dev->bus == &pcie_port_bus_type) { if (dev->bus == &pcie_port_bus_type)
put_device(dev);
device_unregister(dev); device_unregister(dev);
}
return 0; return 0;
} }
...@@ -498,12 +497,12 @@ static int pcie_port_probe_service(struct device *dev) ...@@ -498,12 +497,12 @@ static int pcie_port_probe_service(struct device *dev)
pciedev = to_pcie_device(dev); pciedev = to_pcie_device(dev);
status = driver->probe(pciedev); status = driver->probe(pciedev);
if (!status) { if (status)
dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n", return status;
driver->name);
get_device(dev); dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n", driver->name);
} get_device(dev);
return status; return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment