summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-11-25 15:45:53 +0300
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2022-01-04 17:58:32 +0300
commit489bfc51870b96cd3ad2ef63cf443b5f5d1a8e21 (patch)
tree33613a1d6c815b0d97073eee337796158ae6c37d /drivers/pci
parent5d18d702e5c9309f4195653475c7a7fdde4ca71f (diff)
downloadlinux-489bfc51870b96cd3ad2ef63cf443b5f5d1a8e21.tar.xz
PCI: mvebu: Check that PCI bridge specified in DT has function number zero
Driver cannot handle PCI bridges at non-zero function address. So add appropriate check. Currently all in-tree kernel DTS files set PCI bridge function to zero. Link: https://lore.kernel.org/r/20211125124605.25915-4-pali@kernel.org Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/controller/pci-mvebu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index e4424db808fe..2a2100c2e65d 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -845,6 +845,11 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
port->devfn = of_pci_get_devfn(child);
if (port->devfn < 0)
goto skip;
+ if (PCI_FUNC(port->devfn) != 0) {
+ dev_err(dev, "%s: invalid function number, must be zero\n",
+ port->name);
+ goto skip;
+ }
ret = mvebu_get_tgt_attr(dev->of_node, port->devfn, IORESOURCE_MEM,
&port->mem_target, &port->mem_attr);