Skip to content

Commit

Permalink
PCI: portdrv: add missing irq cleanup
Browse files Browse the repository at this point in the history
Add missing service irqs cleanup in the error code path of
pcie_port_device_register().

Signed-off-by: Kenji Kaneshige <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
  • Loading branch information
kkaneshige authored and jbarnes993 committed Dec 4, 2009
1 parent 1ce5e83 commit fbb5de7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions drivers/pci/pcie/portdrv_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit fbb5de7

Please sign in to comment.