For callers that only need read-only access and don't want an error reported. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/util/virpci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index e45dfbc631..2758ee6f49 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -320,6 +320,12 @@ virPCIDeviceConfigOpen(virPCIDevicePtr dev, bool fatal) return virPCIDeviceConfigOpenInternal(dev, false, fatal); } +static int +virPCIDeviceConfigOpenTry(virPCIDevicePtr dev) +{ + return virPCIDeviceConfigOpenInternal(dev, true, false); +} + static int virPCIDeviceConfigOpenWrite(virPCIDevicePtr dev) { @@ -692,7 +698,7 @@ virPCIDeviceIsParent(virPCIDevicePtr dev, virPCIDevicePtr check, void *data) if (dev->address.domain != check->address.domain) return 0; - if ((fd = virPCIDeviceConfigOpen(check, false)) < 0) + if ((fd = virPCIDeviceConfigOpenTry(check)) < 0) return 0; /* Is it a bridge? */ @@ -740,7 +746,7 @@ virPCIDeviceIsParent(virPCIDevicePtr dev, virPCIDevicePtr check, void *data) int bestfd; uint8_t best_secondary; - if ((bestfd = virPCIDeviceConfigOpen(*best, false)) < 0) + if ((bestfd = virPCIDeviceConfigOpenTry(*best)) < 0) goto cleanup; best_secondary = virPCIDeviceRead8(*best, bestfd, PCI_SECONDARY_BUS); virPCIDeviceConfigClose(*best, bestfd); -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list