diff mbox

[4/7] PCI: iproc: Validate CSR base in BCMA setup code

Message ID 20161007162336.23015.7099.stgit@bhelgaas-glaptop2.roam.corp.google.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Bjorn Helgaas Oct. 7, 2016, 4:23 p.m. UTC
Validate iproc->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 |    5 +++++
 drivers/pci/host/pcie-iproc.c      |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c
index 72273ff..5377328 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)
 	bcma_set_drvdata(bdev, iproc);
 
 	iproc->base = bdev->io_addr;
+	if (!iproc->base) {
+		dev_err(&bdev->dev, "no controller registers\n");
+		return -ENOMEM;
+	}
+
 	iproc->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 38f5ee0..3de157a 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -457,7 +457,7 @@  int iproc_pcie_setup(struct iproc_pcie *iproc, struct list_head *res)
 	void *sysdata;
 	struct pci_bus *bus;
 
-	if (!iproc || !iproc->dev || !iproc->base)
+	if (!iproc || !iproc->dev)
 		return -EINVAL;
 
 	ret = devm_request_pci_bus_resources(iproc->dev, res);