43fe83
From b1878a91f75a26f6c851106df6d83086fe213963 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <b1878a91f75a26f6c851106df6d83086fe213963.1383922565.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Mon, 4 Nov 2013 17:36:00 +0100
43fe83
Subject: [PATCH] virpci: Don't error on unbinded devices
43fe83
43fe83
RHEL-7: https://bugzilla.redhat.com/show_bug.cgi?id=1019387
43fe83
UPSTREAM: https://bugzilla.redhat.com/show_bug.cgi?id=1018897
43fe83
43fe83
If a PCI deivce is not binded to any driver (e.g. there's yet no PCI
43fe83
driver in the linux kernel) but still users want to passthru the device
43fe83
we fail the whole operation as we fail to resolve the 'driver' link
43fe83
under the PCI device sysfs tree. Obviously, this is not a fatal error
43fe83
and it shouldn't be error at all.
43fe83
43fe83
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
43fe83
(cherry picked from commit df4283a55bf3516b333352e2052dbe3317936953)
43fe83
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
43fe83
---
43fe83
 src/util/virpci.c | 5 +----
43fe83
 1 file changed, 1 insertion(+), 4 deletions(-)
43fe83
43fe83
diff --git a/src/util/virpci.c b/src/util/virpci.c
43fe83
index be50b4f..be95d03 100644
43fe83
--- a/src/util/virpci.c
43fe83
+++ b/src/util/virpci.c
43fe83
@@ -1095,11 +1095,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev,
43fe83
     const char *newDriverName = NULL;
43fe83
 
43fe83
     if (virPCIDriverDir(&stubDriverPath, stubDriverName) < 0 ||
43fe83
-        virPCIFile(&driverLink, dev->name, "driver") < 0 ||
43fe83
-        virPCIDeviceGetDriverPathAndName(dev, &oldDriverPath,
43fe83
-                                         &oldDriverName) < 0) {
43fe83
+        virPCIFile(&driverLink, dev->name, "driver") < 0)
43fe83
         goto cleanup;
43fe83
-    }
43fe83
 
43fe83
     if (virFileExists(driverLink)) {
43fe83
         if (virFileLinkPointsTo(driverLink, stubDriverPath)) {
43fe83
-- 
43fe83
1.8.4.2
43fe83