diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-11-25 07:05:01 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-12-04 18:56:06 -0500 |
commit | fbb5de70bbe13ecbebb04226dd6d52b1258dc247 (patch) | |
tree | 0298455195db5d154718fad4cc411125080a9e3a /drivers/pci | |
parent | 1ce5e83063bf388a2c9fa1e3d4d3122146ad305d (diff) |
PCI: portdrv: add missing irq cleanup
Add missing service irqs cleanup in the error code path of
pcie_port_device_register().
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index a2ac618a95be..82a27f93d38b 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -205,6 +205,14 @@ static int init_service_irqs(struct pci_dev *dev, int *irqs, int mask) | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void cleanup_service_irqs(struct pci_dev *dev) | ||
209 | { | ||
210 | if (dev->msix_enabled) | ||
211 | pci_disable_msix(dev); | ||
212 | else if (dev->msi_enabled) | ||
213 | pci_disable_msi(dev); | ||
214 | } | ||
215 | |||
208 | /** | 216 | /** |
209 | * get_port_device_capability - discover capabilities of a PCI Express port | 217 | * get_port_device_capability - discover capabilities of a PCI Express port |
210 | * @dev: PCI Express port to examine | 218 | * @dev: PCI Express port to examine |
@@ -332,10 +340,12 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
332 | } | 340 | } |
333 | if (!nr_serv) { | 341 | if (!nr_serv) { |
334 | status = -ENODEV; | 342 | status = -ENODEV; |
335 | goto error_disable; | 343 | goto error_cleanup_irqs; |
336 | } | 344 | } |
337 | return 0; | 345 | return 0; |
338 | 346 | ||
347 | error_cleanup_irqs: | ||
348 | cleanup_service_irqs(dev); | ||
339 | error_disable: | 349 | error_disable: |
340 | pci_disable_device(dev); | 350 | pci_disable_device(dev); |
341 | error_kfree: | 351 | error_kfree: |
@@ -410,12 +420,7 @@ void pcie_port_device_remove(struct pci_dev *dev) | |||
410 | struct pcie_port_data *port_data = pci_get_drvdata(dev); | 420 | struct pcie_port_data *port_data = pci_get_drvdata(dev); |
411 | 421 | ||
412 | device_for_each_child(&dev->dev, NULL, remove_iter); | 422 | device_for_each_child(&dev->dev, NULL, remove_iter); |
413 | 423 | cleanup_service_irqs(dev); | |
414 | if (dev->msix_enabled) | ||
415 | pci_disable_msix(dev); | ||
416 | else if (dev->msi_enabled) | ||
417 | pci_disable_msi(dev); | ||
418 | |||
419 | pci_disable_device(dev); | 424 | pci_disable_device(dev); |
420 | kfree(port_data); | 425 | kfree(port_data); |
421 | } | 426 | } |