__pci_read_base() will return 1 when it is a 64-bit BAR, which makes the
resource index not correct. So i could not be the index in this case.

Signed-off-by: Wei Yang <weiy...@linux.vnet.ibm.com>
---
 drivers/pci/iov.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 721987b..b348b72 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -444,10 +444,12 @@ found:
                        rc = -EIO;
                        goto failed;
                }
-               iov->barsz[i] = resource_size(res);
+               iov->barsz[res - dev->resource - PCI_IOV_RESOURCES] =
+                       resource_size(res);
                res->end = res->start + resource_size(res) * total - 1;
                dev_info(&dev->dev, "VF BAR%d: %pR (contains BAR%d for %d 
VFs)\n",
-                        i, res, i, total);
+                        (int)(res - dev->resource - PCI_IOV_RESOURCES), res,
+                        (int)(res - dev->resource - PCI_IOV_RESOURCES), total);
                nres++;
        }
 
-- 
1.7.9.5

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to