:p
atchew
Login
These functions return value is invariant since 18f3771, so change its type and remove all dependent checks. Best regards, Alexander Kuznetsov --- v2: - One function per commit. Alexander Kuznetsov (4): util: Change return type of virPCIDeviceSetUsedBy to void util: Change return type of virSCSIDeviceSetUsedBy to void util: Change return type of virSCSIVHostDeviceSetUsedBy to void logging: Change return type of virLogDaemonConfigFilePat to void src/hypervisor/virhostdev.c | 21 +++++++-------------- src/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- src/util/virpci.c | 4 +--- src/util/virpci.h | 2 +- src/util/virscsi.c | 4 +--- src/util/virscsi.h | 2 +- src/util/virscsivhost.c | 6 ++---- src/util/virscsivhost.h | 2 +- tests/virscsitest.c | 6 ++---- 11 files changed, 20 insertions(+), 41 deletions(-) -- 2.42.2
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> --- src/hypervisor/virhostdev.c | 6 ++---- src/util/virpci.c | 4 +--- src/util/virpci.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ 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)); @@ -XXX,XX +XXX,XX @@ 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; diff --git a/src/util/virpci.c b/src/util/virpci.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -XXX,XX +XXX,XX @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprobe) dev->reprobe = reprobe; } -int +void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, const char *dom_name) @@ -XXX,XX +XXX,XX @@ 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 diff --git a/src/util/virpci.h b/src/util/virpci.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -XXX,XX +XXX,XX @@ void virPCIDeviceSetStubDriverName(virPCIDevice *dev, const char *driverName); const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); -int virPCIDeviceSetUsedBy(virPCIDevice *dev, +void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, const char *dom_name); void virPCIDeviceGetUsedBy(virPCIDevice *dev, -- 2.42.2
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> --- src/hypervisor/virhostdev.c | 12 ++++-------- src/util/virscsi.c | 4 +--- src/util/virscsi.h | 2 +- tests/virscsitest.c | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevManager *mgr, return -1; if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) { - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - return -1; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0 || - virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) + if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) return -1; scsi = NULL; } @@ -XXX,XX +XXX,XX @@ virHostdevPrepareSCSIDevices(virHostdevManager *mgr, goto error; } - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name); VIR_DEBUG("Adding %s to activeSCSIHostdevs", virSCSIDeviceGetName(scsi)); diff --git a/src/util/virscsi.c b/src/util/virscsi.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -XXX,XX +XXX,XX @@ virSCSIDeviceFree(virSCSIDevice *dev) g_free(dev); } -int +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, const char *drvname, const char *domname) @@ -XXX,XX +XXX,XX @@ virSCSIDeviceSetUsedBy(virSCSIDevice *dev, copy->domname = g_strdup(domname); VIR_APPEND_ELEMENT(dev->used_by, dev->n_used_by, copy); - - return 0; } bool diff --git a/src/util/virscsi.h b/src/util/virscsi.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsi.h +++ b/src/util/virscsi.h @@ -XXX,XX +XXX,XX @@ virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix, bool shareable); void virSCSIDeviceFree(virSCSIDevice *dev); -int virSCSIDeviceSetUsedBy(virSCSIDevice *dev, +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, const char *drvname, const char *domname); bool virSCSIDeviceIsAvailable(virSCSIDevice *dev); diff --git a/tests/virscsitest.c b/tests/virscsitest.c index XXXXXXX..XXXXXXX 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -XXX,XX +XXX,XX @@ test2(const void *data G_GNUC_UNUSED) if (!virSCSIDeviceIsAvailable(dev)) goto cleanup; - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18"); if (virSCSIDeviceIsAvailable(dev)) goto cleanup; - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20"); if (virSCSIDeviceIsAvailable(dev)) goto cleanup; -- 2.42.2
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> --- src/hypervisor/virhostdev.c | 3 +-- src/util/virscsivhost.c | 6 ++---- src/util/virscsivhost.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ virHostdevPrepareSCSIVHostDevices(virHostdevManager *mgr, if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn))) return -1; - if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0) - return -1; + virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name); if (virSCSIVHostDeviceListAdd(list, host) < 0) return -1; diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -XXX,XX +XXX,XX @@ virSCSIVHostDeviceListNew(void) } -int +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname) @@ -XXX,XX +XXX,XX @@ virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, VIR_FREE(dev->used_by_domname); dev->used_by_drvname = g_strdup(drvname); dev->used_by_domname = g_strdup(domname); - - return 0; } @@ -XXX,XX +XXX,XX @@ virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, { *drv_name = dev->used_by_drvname; *dom_name = dev->used_by_domname; - } +} int diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -XXX,XX +XXX,XX @@ void virSCSIVHostDeviceListDel(virSCSIVHostDeviceList *list, virSCSIVHostDevice *dev); virSCSIVHostDeviceList *virSCSIVHostDeviceListNew(void); virSCSIVHostDevice *virSCSIVHostDeviceNew(const char *name); -int virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname); void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, -- 2.42.2
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> --- src/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - /* No explicit config, so try and find a default one */ + /* No explicit config, so find a default one */ if (remote_config_file == NULL) { implicit_conf = true; - if (virLogDaemonConfigFilePath(privileged, - &remote_config_file) < 0) { - VIR_ERROR(_("Can't determine config path")); - exit(EXIT_FAILURE); - } + virLogDaemonConfigFilePath(privileged, &remote_config_file); } /* Read the config file if it exists */ diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -XXX,XX +XXX,XX @@ VIR_LOG_INIT("logging.log_daemon_config"); -int +void virLogDaemonConfigFilePath(bool privileged, char **configfile) { if (privileged) { @@ -XXX,XX +XXX,XX @@ virLogDaemonConfigFilePath(bool privileged, char **configfile) *configfile = g_strdup_printf("%s/virtlogd.conf", configdir); } - - return 0; } diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon_config.h +++ b/src/logging/log_daemon_config.h @@ -XXX,XX +XXX,XX @@ struct _virLogDaemonConfig { }; -int virLogDaemonConfigFilePath(bool privileged, char **configfile); +void virLogDaemonConfigFilePath(bool privileged, char **configfile); virLogDaemonConfig *virLogDaemonConfigNew(bool privileged); void virLogDaemonConfigFree(virLogDaemonConfig *data); int virLogDaemonConfigLoadFile(virLogDaemonConfig *data, -- 2.42.2
These functions return value is invariant since 18f3771, so change its type and remove all dependent checks. Best regards, Alexander Kuznetsov --- v3: - Fix indentation errors. - 2: add missing virSCSIDeviceSetUsedBy call - 3: remove non-relevant cosmetic fix v2: - One function per commit. Alexander Kuznetsov (4): util: Change return type of virPCIDeviceSetUsedBy to void util: Change return type of virSCSIDeviceSetUsedBy to void util: Change return type of virSCSIVHostDeviceSetUsedBy to void logging: Change return type of virLogDaemonConfigFilePat to void src/hypervisor/virhostdev.c | 22 ++++++++-------------- src/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- src/util/virpci.c | 4 +--- src/util/virpci.h | 6 +++--- src/util/virscsi.c | 4 +--- src/util/virscsi.h | 6 +++--- src/util/virscsivhost.c | 4 +--- src/util/virscsivhost.h | 6 +++--- tests/virscsitest.c | 6 ++---- 11 files changed, 26 insertions(+), 46 deletions(-) -- 2.42.2
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 | 6 ++---- src/util/virpci.c | 4 +--- src/util/virpci.h | 6 +++--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ 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)); @@ -XXX,XX +XXX,XX @@ 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; diff --git a/src/util/virpci.c b/src/util/virpci.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -XXX,XX +XXX,XX @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprobe) dev->reprobe = reprobe; } -int +void virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, const char *dom_name) @@ -XXX,XX +XXX,XX @@ 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 diff --git a/src/util/virpci.h b/src/util/virpci.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -XXX,XX +XXX,XX @@ 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); -- 2.42.2
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> --- src/hypervisor/virhostdev.c | 13 +++++-------- src/util/virscsi.c | 4 +--- src/util/virscsi.h | 6 +++--- tests/virscsitest.c | 6 ++---- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ virHostdevUpdateActiveSCSIHostDevices(virHostdevManager *mgr, return -1; if ((tmp = virSCSIDeviceListFind(mgr->activeSCSIHostdevs, scsi))) { - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - return -1; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0 || - virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) + virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name); + if (virSCSIDeviceListAdd(mgr->activeSCSIHostdevs, scsi) < 0) return -1; scsi = NULL; } @@ -XXX,XX +XXX,XX @@ virHostdevPrepareSCSIDevices(virHostdevManager *mgr, goto error; } - if (virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(tmp, drv_name, dom_name); } else { - if (virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name) < 0) - goto error; + virSCSIDeviceSetUsedBy(scsi, drv_name, dom_name); VIR_DEBUG("Adding %s to activeSCSIHostdevs", virSCSIDeviceGetName(scsi)); diff --git a/src/util/virscsi.c b/src/util/virscsi.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -XXX,XX +XXX,XX @@ virSCSIDeviceFree(virSCSIDevice *dev) g_free(dev); } -int +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, const char *drvname, const char *domname) @@ -XXX,XX +XXX,XX @@ virSCSIDeviceSetUsedBy(virSCSIDevice *dev, copy->domname = g_strdup(domname); VIR_APPEND_ELEMENT(dev->used_by, dev->n_used_by, copy); - - return 0; } bool diff --git a/src/util/virscsi.h b/src/util/virscsi.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsi.h +++ b/src/util/virscsi.h @@ -XXX,XX +XXX,XX @@ virSCSIDevice *virSCSIDeviceNew(const char *sysfs_prefix, bool shareable); void virSCSIDeviceFree(virSCSIDevice *dev); -int virSCSIDeviceSetUsedBy(virSCSIDevice *dev, - const char *drvname, - const char *domname); +void virSCSIDeviceSetUsedBy(virSCSIDevice *dev, + const char *drvname, + const char *domname); bool virSCSIDeviceIsAvailable(virSCSIDevice *dev); const char *virSCSIDeviceGetName(virSCSIDevice *dev); const char *virSCSIDeviceGetPath(virSCSIDevice *dev); diff --git a/tests/virscsitest.c b/tests/virscsitest.c index XXXXXXX..XXXXXXX 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -XXX,XX +XXX,XX @@ test2(const void *data G_GNUC_UNUSED) if (!virSCSIDeviceIsAvailable(dev)) goto cleanup; - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc18"); if (virSCSIDeviceIsAvailable(dev)) goto cleanup; - if (virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20") < 0) - goto cleanup; + virSCSIDeviceSetUsedBy(dev, "QEMU", "fc20"); if (virSCSIDeviceIsAvailable(dev)) goto cleanup; -- 2.42.2
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> --- src/hypervisor/virhostdev.c | 3 +-- src/util/virscsivhost.c | 4 +--- src/util/virscsivhost.h | 6 +++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index XXXXXXX..XXXXXXX 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -XXX,XX +XXX,XX @@ virHostdevPrepareSCSIVHostDevices(virHostdevManager *mgr, if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn))) return -1; - if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0) - return -1; + virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name); if (virSCSIVHostDeviceListAdd(list, host) < 0) return -1; diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -XXX,XX +XXX,XX @@ virSCSIVHostDeviceListNew(void) } -int +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname) @@ -XXX,XX +XXX,XX @@ virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, VIR_FREE(dev->used_by_domname); dev->used_by_drvname = g_strdup(drvname); dev->used_by_domname = g_strdup(domname); - - return 0; } diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h index XXXXXXX..XXXXXXX 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -XXX,XX +XXX,XX @@ void virSCSIVHostDeviceListDel(virSCSIVHostDeviceList *list, virSCSIVHostDevice *dev); virSCSIVHostDeviceList *virSCSIVHostDeviceListNew(void); virSCSIVHostDevice *virSCSIVHostDeviceNew(const char *name); -int virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, - const char *drvname, - const char *domname); +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, + const char *drvname, + const char *domname); void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, const char **drv_name, const char **dom_name); -- 2.42.2
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/logging/log_daemon.c | 8 ++------ src/logging/log_daemon_config.c | 4 +--- src/logging/log_daemon_config.h | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - /* No explicit config, so try and find a default one */ + /* No explicit config, so find a default one */ if (remote_config_file == NULL) { implicit_conf = true; - if (virLogDaemonConfigFilePath(privileged, - &remote_config_file) < 0) { - VIR_ERROR(_("Can't determine config path")); - exit(EXIT_FAILURE); - } + virLogDaemonConfigFilePath(privileged, &remote_config_file); } /* Read the config file if it exists */ diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_config.c index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -XXX,XX +XXX,XX @@ VIR_LOG_INIT("logging.log_daemon_config"); -int +void virLogDaemonConfigFilePath(bool privileged, char **configfile) { if (privileged) { @@ -XXX,XX +XXX,XX @@ virLogDaemonConfigFilePath(bool privileged, char **configfile) *configfile = g_strdup_printf("%s/virtlogd.conf", configdir); } - - return 0; } diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_config.h index XXXXXXX..XXXXXXX 100644 --- a/src/logging/log_daemon_config.h +++ b/src/logging/log_daemon_config.h @@ -XXX,XX +XXX,XX @@ struct _virLogDaemonConfig { }; -int virLogDaemonConfigFilePath(bool privileged, char **configfile); +void virLogDaemonConfigFilePath(bool privileged, char **configfile); virLogDaemonConfig *virLogDaemonConfigNew(bool privileged); void virLogDaemonConfigFree(virLogDaemonConfig *data); int virLogDaemonConfigLoadFile(virLogDaemonConfig *data, -- 2.42.2