summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-25 13:05:01 +0100
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-12-05 00:56:06 +0100
commitfbb5de70bbe13ecbebb04226dd6d52b1258dc247 (patch)
tree0298455195db5d154718fad4cc411125080a9e3a /drivers/pci
parentPCI: portdrv: enable device before irq initialization (diff)
downloadlinux-fbb5de70bbe13ecbebb04226dd6d52b1258dc247.tar.xz
linux-fbb5de70bbe13ecbebb04226dd6d52b1258dc247.zip
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.c19
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)
return 0;
}
+static void cleanup_service_irqs(struct pci_dev *dev)
+{
+ if (dev->msix_enabled)
+ pci_disable_msix(dev);
+ else if (dev->msi_enabled)
+ pci_disable_msi(dev);
+}
+
/**
* get_port_device_capability - discover capabilities of a PCI Express port
* @dev: PCI Express port to examine
@@ -332,10 +340,12 @@ int pcie_port_device_register(struct pci_dev *dev)
}
if (!nr_serv) {
status = -ENODEV;
- goto error_disable;
+ goto error_cleanup_irqs;
}
return 0;
+error_cleanup_irqs:
+ cleanup_service_irqs(dev);
error_disable:
pci_disable_device(dev);
error_kfree:
@@ -410,12 +420,7 @@ void pcie_port_device_remove(struct pci_dev *dev)
struct pcie_port_data *port_data = pci_get_drvdata(dev);
device_for_each_child(&dev->dev, NULL, remove_iter);
-
- if (dev->msix_enabled)
- pci_disable_msix(dev);
- else if (dev->msi_enabled)
- pci_disable_msi(dev);
-
+ cleanup_service_irqs(dev);
pci_disable_device(dev);
kfree(port_data);
}