From nobody Fri Dec 27 12:34:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1732800861050244.78026230857893; Thu, 28 Nov 2024 05:34:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C8611CE8; Thu, 28 Nov 2024 08:34:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 902491AB8; Thu, 28 Nov 2024 08:33:29 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 041B3197F; Thu, 28 Nov 2024 08:31:55 -0500 (EST) Received: from air.basealt.ru (air.basealt.ru [193.43.8.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 43A671966 for ; Thu, 28 Nov 2024 08:31:54 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id 2C61E237AA; Thu, 28 Nov 2024 16:31:53 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 From: Alexander Kuznetsov To: devel@lists.libvirt.org Subject: [PATCH v2 3/4] util: Change return type of virSCSIVHostDeviceSetUsedBy to void Date: Thu, 28 Nov 2024 16:28:09 +0300 Message-ID: <20241128133105.31975-4-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241128133105.31975-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-1-kuznetsovam@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-MailFrom: kuznetsovam@altlinux.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: UXHITFV62ZB2WC3LMBQQEMFZPNHHVHW6 X-Message-ID-Hash: UXHITFV62ZB2WC3LMBQQEMFZPNHHVHW6 X-Mailman-Approved-At: Thu, 28 Nov 2024 13:33:24 -0500 CC: nickel@altlinux.org, egori@altlinux.org, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZM-MESSAGEID: 1732800862843019100 Content-Type: text/plain; charset="utf-8" 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 --- 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 30a51507da..037842c8a1 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1666,8 +1666,7 @@ virHostdevPrepareSCSIVHostDevices(virHostdevManager *= mgr, if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) return -1; =20 - if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0) - return -1; + virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name); =20 if (virSCSIVHostDeviceListAdd(list, host) < 0) return -1; diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c index 15024d7106..05b89e58d6 100644 --- a/src/util/virscsivhost.c +++ b/src/util/virscsivhost.c @@ -193,7 +193,7 @@ virSCSIVHostDeviceListNew(void) } =20 =20 -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 =3D g_strdup(drvname); dev->used_by_domname =3D g_strdup(domname); - - return 0; } =20 =20 @@ -214,7 +212,7 @@ virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevice *dev, { *drv_name =3D dev->used_by_drvname; *dom_name =3D dev->used_by_domname; - } +} =20 =20 int diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h index a7299382db..caaac26328 100644 --- a/src/util/virscsivhost.h +++ b/src/util/virscsivhost.h @@ -50,7 +50,7 @@ void virSCSIVHostDeviceListDel(virSCSIVHostDeviceList *li= st, 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, --=20 2.42.2