summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-12-20 12:41:18 -0700
committerBjorn Helgaas <bhelgaas@google.com>2013-12-20 12:41:18 -0700
commitf72e11123ba122c4ed8fcee52ab57cf3fbe81178 (patch)
treeb7fa6517acff9c42faa3f314cc5efa72109c80ae /drivers/pci/pcie
parent9dc1d43ff95152e7ffdf45def855ea6931d95a15 (diff)
parente75f34ce6633549486a044d64b2a79240d4113a8 (diff)
downloadlinux-f72e11123ba122c4ed8fcee52ab57cf3fbe81178.tar.bz2
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
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r--drivers/pci/pcie/portdrv_core.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index ce9d9ae17bfd..16a1ce4f6b18 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -344,11 +344,12 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
device_enable_async_suspend(device);
retval = device_register(device);
- if (retval)
- kfree(pcie);
- else
- get_device(device);
- return retval;
+ if (retval) {
+ put_device(device);
+ return retval;
+ }
+
+ return 0;
}
/**
@@ -454,10 +455,8 @@ int pcie_port_device_resume(struct device *dev)
static int remove_iter(struct device *dev, void *data)
{
- if (dev->bus == &pcie_port_bus_type) {
- put_device(dev);
+ if (dev->bus == &pcie_port_bus_type)
device_unregister(dev);
- }
return 0;
}
@@ -498,12 +497,12 @@ static int pcie_port_probe_service(struct device *dev)
pciedev = to_pcie_device(dev);
status = driver->probe(pciedev);
- if (!status) {
- dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n",
- driver->name);
- get_device(dev);
- }
- return status;
+ if (status)
+ return status;
+
+ dev_printk(KERN_DEBUG, dev, "service driver %s loaded\n", driver->name);
+ get_device(dev);
+ return 0;
}
/**