summaryrefslogtreecommitdiff
path: root/drivers/pci/pcie/portdrv_core.c
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-11-25 21:03:27 +0900
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-12-04 15:55:44 -0800
commitd013598d9a46befebdfd37195829ce411e4878ea (patch)
tree92d461ff66a29cbf9b23af2570de4a99ad9a16c6 /drivers/pci/pcie/portdrv_core.c
parent9e5d0b16dada536dfe2f1e893b6ad0225ff8a2c9 (diff)
PCI: portdrv: check capabilities first
Move capability check capability to the beginning of pcie_port_device_register() prevents redundant execution path. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie/portdrv_core.c')
-rw-r--r--drivers/pci/pcie/portdrv_core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 079bbc3ed4f8..52c4e6fd6fd4 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -297,6 +297,10 @@ int pcie_port_device_register(struct pci_dev *dev)
int status, capabilities, irq_mode, i, nr_serv;
int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
+ capabilities = get_port_device_capability(dev);
+ if (!capabilities)
+ return -ENODEV;
+
port_data = kzalloc(sizeof(*port_data), GFP_KERNEL);
if (!port_data)
return -ENOMEM;
@@ -304,8 +308,6 @@ int pcie_port_device_register(struct pci_dev *dev)
port_data->port_type = dev->pcie_type;
- capabilities = get_port_device_capability(dev);
-
irq_mode = assign_interrupt_mode(dev, vectors, capabilities);
if (irq_mode == PCIE_PORT_NO_IRQ) {
/*