]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Change return type of virPCIDeviceSetUsedBy to void
authorAlexander Kuznetsov <kuznetsovam@altlinux.org>
Mon, 16 Dec 2024 09:41:05 +0000 (12:41 +0300)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 16 Dec 2024 10:28:21 +0000 (11:28 +0100)
This function return value is invariant since 18f3771, so change
its type and remove all dependent checks.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Reported-by: Pavel Nekrasov <p.nekrasov@fobos-nt.ru>
Signed-off-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/hypervisor/virhostdev.c
src/util/virpci.c
src/util/virpci.h

index db94a2e056a32e60896e228d63f1b1ee73da4af0..f8b5ab86e18d1189785cb08f647cb51566531794 100644 (file)
@@ -1131,8 +1131,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManager *mgr,
         if (!actual)
             continue;
 
-        if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0)
-            goto cleanup;
+        virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
 
         /* Setup the original states for the PCI device */
         virPCIDeviceSetUnbindFromStub(actual, virBitmapIsBitSet(orig, VIR_DOMAIN_HOSTDEV_PCI_ORIGSTATE_UNBIND));
@@ -2480,8 +2479,7 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
 
         /* We must restore some attributes that were lost on daemon restart. */
         virPCIDeviceSetUnbindFromStub(actual, true);
-        if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0)
-            goto rollback;
+        virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
 
         if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual) < 0)
             goto rollback;
index 289c0b330bf0735ac690e4d656939209920310e2..90617e69c6db611bfbe4b92a13940ae09c79dc39 100644 (file)
@@ -2049,7 +2049,7 @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprobe)
     dev->reprobe = reprobe;
 }
 
-int
+void
 virPCIDeviceSetUsedBy(virPCIDevice *dev,
                       const char *drv_name,
                       const char *dom_name)
@@ -2058,8 +2058,6 @@ virPCIDeviceSetUsedBy(virPCIDevice *dev,
     VIR_FREE(dev->used_by_domname);
     dev->used_by_drvname = g_strdup(drv_name);
     dev->used_by_domname = g_strdup(dom_name);
-
-    return 0;
 }
 
 void
index ba5e0ae6f18d1bf5b4a8cff8211f1e1bc2c34596..4409864057b7a4482fe5d3ed56599de9329a9b12 100644 (file)
@@ -136,9 +136,9 @@ void virPCIDeviceSetStubDriverName(virPCIDevice *dev,
                                    const char *driverName);
 const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev);
 virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev);
-int virPCIDeviceSetUsedBy(virPCIDevice *dev,
-                          const char *drv_name,
-                          const char *dom_name);
+void virPCIDeviceSetUsedBy(virPCIDevice *dev,
+                           const char *drv_name,
+                           const char *dom_name);
 void virPCIDeviceGetUsedBy(virPCIDevice *dev,
                            const char **drv_name,
                            const char **dom_name);