From patchwork Wed Nov 25 12:03:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenji Kaneshige X-Patchwork-Id: 62759 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAPC3Ve6016032 for ; Wed, 25 Nov 2009 12:03:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758639AbZKYMDk (ORCPT ); Wed, 25 Nov 2009 07:03:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758699AbZKYMDk (ORCPT ); Wed, 25 Nov 2009 07:03:40 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:54728 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758639AbZKYMDj (ORCPT ); Wed, 25 Nov 2009 07:03:39 -0500 Received: from m1.gw.fujitsu.co.jp ([10.0.50.71]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id nAPC3jo6030695 for (envelope-from kaneshige.kenji@jp.fujitsu.com); Wed, 25 Nov 2009 21:03:45 +0900 Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id DCA0B45DE4F for ; Wed, 25 Nov 2009 21:03:44 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id BCB6945DE4E for ; Wed, 25 Nov 2009 21:03:44 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id A81A31DB803C for ; Wed, 25 Nov 2009 21:03:44 +0900 (JST) Received: from m105.s.css.fujitsu.com (m105.s.css.fujitsu.com [10.249.87.105]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 671C91DB803A for ; Wed, 25 Nov 2009 21:03:44 +0900 (JST) Received: from m105.css.fujitsu.com (m105 [127.0.0.1]) by m105.s.css.fujitsu.com (Postfix) with ESMTP id 406535D8005; Wed, 25 Nov 2009 21:03:44 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.100.137]) by m105.s.css.fujitsu.com (Postfix) with ESMTP id E25F35D8003; Wed, 25 Nov 2009 21:03:43 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KANE-LIFEBOOK[10.124.100.137] by KANE-LIFEBOOK (FujitsuOutboundMailChecker v1.3.1/9992[10.124.100.137]); Wed, 25 Nov 2009 21:03:30 +0900 (JST) Message-ID: <4B0D1D0F.4010206@jp.fujitsu.com> Date: Wed, 25 Nov 2009 21:03:27 +0900 From: Kenji Kaneshige User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: linux-pci@vger.kernel.org, jbarnes@virtuousgeek.org Subject: [PATCH 5/11] portdrv: check capabilities first References: <4B0D1C19.8060201@jp.fujitsu.com> In-Reply-To: <4B0D1C19.8060201@jp.fujitsu.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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) { /*