[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu_hotplug: Resolve DEADCODE coverity error



Remove unused 'cgroup' variable in qemuDomainAttachDeviceDiskLive() to
resolve coverity DEADCODE complaint

---
Refactoring of qemuDomainAttachDeviceDiskLive() in the following patch:

https://www.redhat.com/archives/libvir-list/2013-August/msg00079.html

seemed to wake up Coverity and it complained about deadcode as a result
of 'cgroup' only ever been NULL thus the check for it to be non-NULL in
order to call qemuTeardownDiskCgroup() would not be able to occur. The
code actually hadn't changed, but for some reason coverity now found it.

Followed example in qemuDomainChangeDiskMediaLive() and just removed the
'cgroup' variable.

 src/qemu/qemu_hotplug.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9c655ff..6cdee44 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -683,7 +683,6 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
     virDomainDiskDefPtr orig_disk = NULL;
     virDomainDeviceDefPtr dev_copy = NULL;
     virDomainDiskDefPtr tmp = NULL;
-    virCgroupPtr cgroup = NULL;
     virCapsPtr caps = NULL;
     int ret = -1;
 
@@ -773,10 +772,10 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
         break;
     }
 
-    if (ret != 0 && cgroup) {
-        if (qemuTeardownDiskCgroup(vm, disk) < 0)
-            VIR_WARN("Failed to teardown cgroup for disk path %s",
-                     NULLSTR(disk->src));
+    if (ret != 0 &&
+        qemuTeardownDiskCgroup(vm, disk) < 0) {
+        VIR_WARN("Failed to teardown cgroup for disk path %s",
+                 NULLSTR(disk->src));
     }
 
 end:
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]