diff mbox

[kvm-unit-tests,v2,07/10] lib/pci: make PCIDEVADDR_INVALID truly invalid

Message ID 1452876695-9240-8-git-send-email-drjones@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Jones Jan. 15, 2016, 4:51 p.m. UTC
dev addr 0 is valid, just not for the pci-testdev (since the host
bridge is already there). So, while it's not a problem, let's
"fix" it anyway.

Suggested-by: Alexander Gordeev <agordeev@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/pci.h    | 2 +-
 x86/vmexit.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/pci.h b/lib/pci.h
index 9e62d120a52d6..9160cfb5950d0 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -12,7 +12,7 @@ 
 
 typedef uint16_t pcidevaddr_t;
 enum {
-    PCIDEVADDR_INVALID = 0x0
+    PCIDEVADDR_INVALID = 0xffff,
 };
 pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id);
 unsigned long pci_bar_addr(pcidevaddr_t dev, int bar_num);
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 7b68896fe9494..321ebda35b449 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -388,7 +388,7 @@  int main(int ac, char **av)
 	printf("PM timer port is %x\n", pm_tmr_blk);
 
 	pcidev = pci_find_dev(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_TEST);
-	if (pcidev) {
+	if (pcidev != PCIDEVADDR_INVALID) {
 		for (i = 0; i < PCI_TESTDEV_NUM_BARS; i++) {
 			if (!pci_bar_is_valid(pcidev, i)) {
 				continue;