util: Change return type of virPCIDeviceSetUsedBy to void

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>
This commit is contained in:
Alexander Kuznetsov 2024-12-16 12:41:05 +03:00 committed by Jiri Denemark
parent 4e987a86b5
commit ed8eec073f
3 changed files with 6 additions and 10 deletions

View File

@ -1131,8 +1131,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManager *mgr,
if (!actual) if (!actual)
continue; continue;
if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
goto cleanup;
/* Setup the original states for the PCI device */ /* Setup the original states for the PCI device */
virPCIDeviceSetUnbindFromStub(actual, virBitmapIsBitSet(orig, VIR_DOMAIN_HOSTDEV_PCI_ORIGSTATE_UNBIND)); 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. */ /* We must restore some attributes that were lost on daemon restart. */
virPCIDeviceSetUnbindFromStub(actual, true); virPCIDeviceSetUnbindFromStub(actual, true);
if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) virPCIDeviceSetUsedBy(actual, drv_name, dom_name);
goto rollback;
if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual) < 0) if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual) < 0)
goto rollback; goto rollback;

View File

@ -2049,7 +2049,7 @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprobe)
dev->reprobe = reprobe; dev->reprobe = reprobe;
} }
int void
virPCIDeviceSetUsedBy(virPCIDevice *dev, virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name, const char *drv_name,
const char *dom_name) const char *dom_name)
@ -2058,8 +2058,6 @@ virPCIDeviceSetUsedBy(virPCIDevice *dev,
VIR_FREE(dev->used_by_domname); VIR_FREE(dev->used_by_domname);
dev->used_by_drvname = g_strdup(drv_name); dev->used_by_drvname = g_strdup(drv_name);
dev->used_by_domname = g_strdup(dom_name); dev->used_by_domname = g_strdup(dom_name);
return 0;
} }
void void

View File

@ -136,9 +136,9 @@ void virPCIDeviceSetStubDriverName(virPCIDevice *dev,
const char *driverName); const char *driverName);
const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev); const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev);
virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev);
int virPCIDeviceSetUsedBy(virPCIDevice *dev, void virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name, const char *drv_name,
const char *dom_name); const char *dom_name);
void virPCIDeviceGetUsedBy(virPCIDevice *dev, void virPCIDeviceGetUsedBy(virPCIDevice *dev,
const char **drv_name, const char **drv_name,
const char **dom_name); const char **dom_name);