summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorMinghuan Lian <Minghuan.Lian@freescale.com>2013-10-08 09:34:41 (GMT)
committerJose Rivera <German.Rivera@freescale.com>2014-03-17 19:33:45 (GMT)
commite0bfc429895c7f0b49dea2f4f5794b8f295edf9a (patch)
tree92763593b0f64f3520067776aae8ab7ddfec8bab /drivers/vfio
parent31321fcc68a8140a0b87f0446179f0c53d563103 (diff)
downloadlinux-fsl-qoriq-e0bfc429895c7f0b49dea2f4f5794b8f295edf9a.tar.xz
fsl_pci_ep: fix checking PCI register size
For T4240, the first PCI controller whose register size is 0x10000, has two physical functions and each physical function register size is 0x2000. But for some older platform PCI controller size is 0x1000 less than 0x2000. The original checking of PCI register size is mistaken. The patch is to fix this issue. Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com> Change-Id: I089adfb5f31f09f57ea1c2ee29572ac3c68992f4 Reviewed-on: http://git.am.freescale.net:8181/9601 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Tiefei Zang <tie-fei.zang@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/fsl_pci_ep/fsl_pci_ep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/vfio/fsl_pci_ep/fsl_pci_ep.c b/drivers/vfio/fsl_pci_ep/fsl_pci_ep.c
index a09950f..18fc5b7 100644
--- a/drivers/vfio/fsl_pci_ep/fsl_pci_ep.c
+++ b/drivers/vfio/fsl_pci_ep/fsl_pci_ep.c
@@ -772,14 +772,14 @@ int fsl_pci_pf_setup(struct pci_bus *bus, int pf_num)
return -ENOMEM;
}
- if (resource_size(&rsrc) < (PCI_EP_PF_OFFSET * pf_num))
- return -EINVAL;
-
if (pf_num > 1)
regs_size = PCI_EP_PF_OFFSET;
else
regs_size = resource_size(&rsrc);
+ if (resource_size(&rsrc) < (regs_size * pf_num))
+ return -EINVAL;
+
for (pf_idx = 0; pf_idx < pf_num; pf_idx++) {
pdev = alloc_pci_dev();
if (!pdev)