1 From e619fe9eb65d8064739f16eca2015145ac920f13 Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Tue, 13 Aug 2013 14:25:21 +0200
4 Subject: [PATCH 201/203] PCI: mvebu: increment nports only for registered
7 The number of ports is probed by counting the number of available child nodes.
8 Later on, the registration of a port can fail and cause a mismatch between
9 the ->nports counter and registered ports. This patch modifies the counting
10 strategy, to make ->nports represent the number of registered ports instead
11 of the number of available childs.
13 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
14 Signed-off-by: Jason Cooper <jason@lakedaemon.net>
16 drivers/pci/host/pci-mvebu.c | 7 ++++---
17 1 file changed, 4 insertions(+), 3 deletions(-)
19 --- a/drivers/pci/host/pci-mvebu.c
20 +++ b/drivers/pci/host/pci-mvebu.c
21 @@ -841,13 +841,14 @@ static int __init mvebu_pcie_probe(struc
26 for_each_child_of_node(pdev->dev.of_node, child) {
27 if (!of_device_is_available(child))
33 - pcie->ports = devm_kzalloc(&pdev->dev, pcie->nports *
34 + pcie->ports = devm_kzalloc(&pdev->dev, i *
35 sizeof(struct mvebu_pcie_port),
38 @@ -934,8 +935,8 @@ static int __init mvebu_pcie_probe(struc
43 mvebu_pcie_msi_enable(pcie);
45 mvebu_pcie_enable(pcie);