]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: iproc: Validate CSR base in BCMA setup code
authorBjorn Helgaas <bhelgaas@google.com>
Thu, 6 Oct 2016 18:36:07 +0000 (13:36 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 12 Oct 2016 03:38:51 +0000 (22:38 -0500)
Validate iproc_pcie->base for BCMA devices just like we already do for
platform devices in iproc_pcie_pltfm_probe().  No functional change
intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/host/pcie-iproc-bcma.c
drivers/pci/host/pcie-iproc.c

index ec6edafdaabfc7ebead38a7fd7da272df96bf9c9..8ce089043a27dcd05be911bd1cd953e4abe92af0 100644 (file)
@@ -55,6 +55,11 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
        pcie->dev = dev;
 
        pcie->base = bdev->io_addr;
+       if (!pcie->base) {
+               dev_err(dev, "no controller registers\n");
+               return -ENOMEM;
+       }
+
        pcie->base_addr = bdev->addr;
 
        res_mem.start = bdev->addr_s[0];
index c41d6bdf66dd8de817b34b6b02ebfbd06181f4d4..12a515622aef1167028376019bd2a2d2e478cac8 100644 (file)
@@ -462,7 +462,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
        void *sysdata;
        struct pci_bus *bus;
 
-       if (!pcie || !pcie->dev || !pcie->base)
+       if (!pcie || !pcie->dev)
                return -EINVAL;
 
        dev = pcie->dev;