From nobody Sun Dec 7 06:43:59 2025 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 1734342276274928.9020819374387; Mon, 16 Dec 2024 01:44:36 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4AACD153A; Mon, 16 Dec 2024 04:44:35 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0276F1506; Mon, 16 Dec 2024 04:43:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 758C6B33; Mon, 16 Dec 2024 04:43:52 -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 DA988B0E for ; Mon, 16 Dec 2024 04:43:51 -0500 (EST) Received: from kuznetsovam-nb.office.basealt.ru (unknown [193.43.10.250]) by air.basealt.ru (Postfix) with ESMTPSA id AF08C23391; Mon, 16 Dec 2024 12:43:50 +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=-0.7 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: jdenemar@redhat.com, devel@lists.libvirt.org Subject: [PATCH v3 1/4] util: Change return type of virPCIDeviceSetUsedBy to void Date: Mon, 16 Dec 2024 12:41:05 +0300 Message-ID: <20241216094308.17957-2-kuznetsovam@altlinux.org> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241216094308.17957-1-kuznetsovam@altlinux.org> References: <20241128133105.31975-1-kuznetsovam@altlinux.org> <20241216094308.17957-1-kuznetsovam@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CHD4PRZF2BPQCSLXBXNVUFEDCW5733G7 X-Message-ID-Hash: CHD4PRZF2BPQCSLXBXNVUFEDCW5733G7 X-MailFrom: kuznetsovam@altlinux.org 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header 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: 1734342277083116600 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 Reviewed-by: Jiri Denemark --- 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 db94a2e056..f8b5ab86e1 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -1131,8 +1131,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManager *m= gr, if (!actual) continue; =20 - if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) - goto cleanup; + virPCIDeviceSetUsedBy(actual, drv_name, dom_name); =20 /* 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, =20 /* We must restore some attributes that were lost on daemon restar= t. */ virPCIDeviceSetUnbindFromStub(actual, true); - if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) - goto rollback; + virPCIDeviceSetUsedBy(actual, drv_name, dom_name); =20 if (virPCIDeviceListAddCopy(hostdev_mgr->activePCIHostdevs, actual= ) < 0) goto rollback; diff --git a/src/util/virpci.c b/src/util/virpci.c index 289c0b330b..90617e69c6 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2049,7 +2049,7 @@ virPCIDeviceSetReprobe(virPCIDevice *dev, bool reprob= e) dev->reprobe =3D reprobe; } =20 -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 =3D g_strdup(drv_name); dev->used_by_domname =3D g_strdup(dom_name); - - return 0; } =20 void diff --git a/src/util/virpci.h b/src/util/virpci.h index ba5e0ae6f1..4409864057 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -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); --=20 2.42.2