[PATCH 8/11] portdrv: add missing irq cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add missing service irqs cleanup in the error code path of
pcie_port_device_register().

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>

---
 drivers/pci/pcie/portdrv_core.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Index: 20091125/drivers/pci/pcie/portdrv_core.c
===================================================================
--- 20091125.orig/drivers/pci/pcie/portdrv_core.c
+++ 20091125/drivers/pci/pcie/portdrv_core.c
@@ -205,6 +205,14 @@ static int init_service_irqs(struct pci_
 	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
 	}
 	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_
 	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);
 }

--
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

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux