From: Bjorn Helgaas Date: Thu, 6 Oct 2016 18:36:07 +0000 (-0500) Subject: PCI: iproc: Validate CSR base in BCMA setup code X-Git-Tag: v5.15~12665^2~2^4~2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f66e5b290796aeb6c5e027506175c87978f2722a;p=mirror_ubuntu-kernels.git PCI: iproc: Validate CSR base in BCMA setup code 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 --- diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c index ec6edafdaabf..8ce089043a27 100644 --- a/drivers/pci/host/pcie-iproc-bcma.c +++ b/drivers/pci/host/pcie-iproc-bcma.c @@ -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]; diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index c41d6bdf66dd..12a515622aef 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -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;