diff mbox

[kvm-unit-tests,v3,2/6] pci: Do not use 0 for unimplemented BARs in pci_dev::resource[]

Message ID 7b08cb7507a2a1484a8bf34fffb3d066e01fdacf.1488204259.git.agordeev@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Gordeev Feb. 27, 2017, 2:12 p.m. UTC
Zero could be a legitimate address inn PIO address space.
Thus, marking unimplemented BARs using zero is a bad idea.
Use INVALID_PHYS_ADDR instead.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 lib/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/pci.c b/lib/pci.c
index 62b1c6b0b7c5..28ef5781a07a 100644
--- a/lib/pci.c
+++ b/lib/pci.c
@@ -336,7 +336,7 @@  void pci_scan_bars(struct pci_dev *dev)
 		dev->resource[i] = pci_bar_get_addr(dev, i);
 		if (pci_bar_is64(dev, i)) {
 			i++;
-			dev->resource[i] = (phys_addr_t)0;
+			dev->resource[i] = INVALID_PHYS_ADDR;
 		}
 	}
 }