summaryrefslogtreecommitdiff
path: root/drivers/pci/host
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-08-13 12:25:21 (GMT)
committerJason Cooper <jason@lakedaemon.net>2013-09-30 14:58:35 (GMT)
commitbf09b6ae588f7567bcf31d9eff313d4d9fdc664e (patch)
treeeb59c23af7b7a6f5bf8e0e3076f15b4894e13ba7 /drivers/pci/host
parentb42285f66f871a9898a0e79e2d74bc7e7a101995 (diff)
downloadlinux-fsl-qoriq-bf09b6ae588f7567bcf31d9eff313d4d9fdc664e.tar.xz
PCI: mvebu: increment nports only for registered ports
The number of ports is probed by counting the number of available child nodes. Later on, the registration of a port can fail and cause a mismatch between the ->nports counter and registered ports. This patch modifies the counting strategy, to make ->nports represent the number of registered ports instead of the number of available childs. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/pci/host')
-rw-r--r--drivers/pci/host/pci-mvebu.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 5c327ce..87aaed5 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -842,13 +842,14 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
return ret;
}
+ i = 0;
for_each_child_of_node(pdev->dev.of_node, child) {
if (!of_device_is_available(child))
continue;
- pcie->nports++;
+ i++;
}
- pcie->ports = devm_kzalloc(&pdev->dev, pcie->nports *
+ pcie->ports = devm_kzalloc(&pdev->dev, i *
sizeof(struct mvebu_pcie_port),
GFP_KERNEL);
if (!pcie->ports)
@@ -935,8 +936,8 @@ static int __init mvebu_pcie_probe(struct platform_device *pdev)
i++;
}
+ pcie->nports = i;
mvebu_pcie_msi_enable(pcie);
-
mvebu_pcie_enable(pcie);
return 0;