[PATCH v9 12/30] PCI: mvebu: Check valid base address before port setup

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Fri Jul 26 09:17:49 EDT 2013


This driver does not fail to probe when it cannot obtain
a port base address. Therefore, add a check for NULL base address
before setting up the port, which prevents a kernel panic in such
cases.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia at free-electrons.com>
Tested-by: Andrew Lunn <andrew at lunn.ch>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
---
 drivers/pci/host/pci-mvebu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 424a7b8..338691b 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -662,6 +662,8 @@ static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
 
 	for (i = 0; i < pcie->nports; i++) {
 		struct mvebu_pcie_port *port = &pcie->ports[i];
+		if (!port->base)
+			continue;
 		mvebu_pcie_setup_hw(port);
 	}
 
-- 
1.8.1.5




More information about the linux-arm-kernel mailing list