diff mbox

[5/11] portdrv: check capabilities first

Message ID 4B0D1D0F.4010206@jp.fujitsu.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Kenji Kaneshige Nov. 25, 2009, 12:03 p.m. UTC
None
diff mbox

Patch

Index: 20091125/drivers/pci/pcie/portdrv_core.c
===================================================================
--- 20091125.orig/drivers/pci/pcie/portdrv_core.c
+++ 20091125/drivers/pci/pcie/portdrv_core.c
@@ -297,6 +297,10 @@  int pcie_port_device_register(struct pci
 	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
 
 	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) {
 		/*