Patchwork [1/2] PCI: decrease pci_dev->enable_cnt when no pcie capability found

login
register
mail settings
Submitter Yijing Wang
Date April 1, 2013, 8:42 a.m.
Message ID <1364805775-12396-1-git-send-email-wangyijing@huawei.com>
Download mbox | patch
Permalink /patch/232680/
State Superseded
Headers show

Comments

Yijing Wang - April 1, 2013, 8:42 a.m.
We should decrease dev->enable_cnt when no pcie port capability
found for balance.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
 drivers/pci/pcie/portdrv_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 31063ac..dd95d6f 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -369,8 +369,10 @@  int pcie_port_device_register(struct pci_dev *dev)
 
 	/* Get and check PCI Express port services */
 	capabilities = get_port_device_capability(dev);
-	if (!capabilities)
+	if (!capabilities) {
+		pci_disable_device(dev);
 		return 0;
+	}
 
 	pci_set_master(dev);
 	/*