]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
mdev: Cleanup code after commits @daf5081b and @2739a983
authorErik Skultety <eskultet@redhat.com>
Thu, 4 May 2017 13:36:37 +0000 (15:36 +0200)
committerErik Skultety <eskultet@redhat.com>
Tue, 9 May 2017 11:01:37 +0000 (13:01 +0200)
So, because mingw is somehow OK with dereferencing a pointer within a
VIR_DEBUG macro, compared to outside of it to which it complained with a
"potential NULL pointer dereference" error (still a false positive), we
can make the code a tiny bit cleaner.

Sighed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/util/virmdev.c

index 174f48cb3018c5b6426baa7ece0c79a6afac5f69..bd8e3f8dea00c185db42323d3dc5a6d0aaa7e739 100644 (file)
@@ -449,13 +449,8 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
 
     virObjectLock(dst);
     for (i = 0; i < count; i++) {
-        const char *mdev_path = NULL;
         virMediatedDevicePtr mdev = virMediatedDeviceListGet(src, i);
 
-        if (!mdev)
-            goto cleanup;
-
-        mdev_path = mdev->path;
         if (virMediatedDeviceIsUsed(mdev, dst) ||
             virMediatedDeviceSetUsedBy(mdev, drvname, domname) < 0)
             goto cleanup;
@@ -464,11 +459,11 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
          * - caller is responsible for NOT freeing devices in @src on success
          * - we're responsible for performing a rollback on failure
          */
+        VIR_DEBUG("Add '%s' to list of active mediated devices used by '%s'",
+                  mdev->path, domname);
         if (virMediatedDeviceListAdd(dst, &mdev) < 0)
             goto rollback;
 
-        VIR_DEBUG("'%s' added to list of active mediated devices used by '%s'",
-                  mdev_path, domname);
     }
 
     ret = 0;