From 0e1a848733c5e9d4066eac9096147f2cb523f319 Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Mon, 16 Dec 2024 12:41:07 +0300 Subject: [PATCH] util: Change return type of virSCSIVHostDeviceSetUsedBy 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 Signed-off-by: Alexander Kuznetsov Reviewed-by: Jiri Denemark --- 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 84c036e075..0a1d8500d4 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1667,8 +1667,7 @@ 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 15024d7106..6934fd574b 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -193,7 +193,7 @@ virSCSIVHostDeviceListNew(void) } -int +void virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevice *dev, const char *drvname, const char *domname) @@ -202,8 +202,6 @@ 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 a7299382db..48b5fdec78 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -50,9 +50,9 @@ 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);