diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-11-25 07:03:27 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-12-04 18:55:44 -0500 |
commit | d013598d9a46befebdfd37195829ce411e4878ea (patch) | |
tree | 92d461ff66a29cbf9b23af2570de4a99ad9a16c6 /drivers/pci/pcie | |
parent | 9e5d0b16dada536dfe2f1e893b6ad0225ff8a2c9 (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')
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 6 |
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) | |||
297 | int status, capabilities, irq_mode, i, nr_serv; | 297 | int status, capabilities, irq_mode, i, nr_serv; |
298 | int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; | 298 | int vectors[PCIE_PORT_DEVICE_MAXSERVICES]; |
299 | 299 | ||
300 | capabilities = get_port_device_capability(dev); | ||
301 | if (!capabilities) | ||
302 | return -ENODEV; | ||
303 | |||
300 | port_data = kzalloc(sizeof(*port_data), GFP_KERNEL); | 304 | port_data = kzalloc(sizeof(*port_data), GFP_KERNEL); |
301 | if (!port_data) | 305 | if (!port_data) |
302 | return -ENOMEM; | 306 | return -ENOMEM; |
@@ -304,8 +308,6 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
304 | 308 | ||
305 | port_data->port_type = dev->pcie_type; | 309 | port_data->port_type = dev->pcie_type; |
306 | 310 | ||
307 | capabilities = get_port_device_capability(dev); | ||
308 | |||
309 | irq_mode = assign_interrupt_mode(dev, vectors, capabilities); | 311 | irq_mode = assign_interrupt_mode(dev, vectors, capabilities); |
310 | if (irq_mode == PCIE_PORT_NO_IRQ) { | 312 | if (irq_mode == PCIE_PORT_NO_IRQ) { |
311 | /* | 313 | /* |