c9022bbc77457cd3e43e3b7a0efc6bc2d78f9ebd
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0048-PCI-mvebu-Check-valid-base-address-before-port-setup.patch
1 From 3dc077a80c71050e198e7884707ece042443fe3c Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
3 Date: Tue, 23 Jul 2013 07:36:00 -0300
4 Subject: [PATCH 048/203] PCI: mvebu: Check valid base address before port
5  setup
6
7 This driver does not fail to probe when it cannot obtain
8 a port base address. Therefore, add a check for NULL base address
9 before setting up the port, which prevents a kernel panic in such
10 cases.
11
12 Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
13 Tested-by: Andrew Lunn <andrew@lunn.ch>
14 Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
15 ---
16  drivers/pci/host/pci-mvebu.c | 2 ++
17  1 file changed, 2 insertions(+)
18
19 --- a/drivers/pci/host/pci-mvebu.c
20 +++ b/drivers/pci/host/pci-mvebu.c
21 @@ -637,6 +637,8 @@ static int __init mvebu_pcie_setup(int n
22  
23         for (i = 0; i < pcie->nports; i++) {
24                 struct mvebu_pcie_port *port = &pcie->ports[i];
25 +               if (!port->base)
26 +                       continue;
27                 mvebu_pcie_setup_hw(port);
28         }
29