From nobody Wed Jan 15 11:36:46 2025 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=quarantine dis=none) header.from=swemel.ru Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704897680269193.2141524407873; Wed, 10 Jan 2024 06:41:20 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 3D0641D34; Wed, 10 Jan 2024 09:41:17 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 000861CE5; Wed, 10 Jan 2024 09:24:05 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id EC2AF1BB2; Wed, 10 Jan 2024 09:23:12 -0500 (EST) Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) (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 7409C1C02 for ; Wed, 10 Jan 2024 09:21:58 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 From: Dmitry Frolov To: devel@lists.libvirt.org Subject: [PATCH v4 06/19] conf: change type to void virDomainHostdevInsert() Date: Wed, 10 Jan 2024 17:21:21 +0300 Message-Id: <20240110142134.915450-7-frolov@swemel.ru> In-Reply-To: <20240110142134.915450-1-frolov@swemel.ru> References: <47d3cbc0-003b-4829-8038-8e00bbdb5c85@redhat.com> <20240110142134.915450-1-frolov@swemel.ru> MIME-Version: 1.0 Message-ID-Hash: 57PWQFAV3O2EGCPPJRAGZROWTM3KBLZV X-Message-ID-Hash: 57PWQFAV3O2EGCPPJRAGZROWTM3KBLZV X-MailFrom: frolov@swemel.ru 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: sdl.libvirt@linuxtesting.org, Dmitry Frolov 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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704897681534100001 virDomainHostdevInsert() returns nothing except 0. Changing return type to void. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov --- src/conf/domain_conf.c | 15 +++++---------- src/conf/domain_conf.h | 2 +- src/libxl/libxl_domain.c | 3 +-- src/libxl/libxl_driver.c | 3 +-- src/lxc/lxc_driver.c | 3 +-- src/qemu/qemu_driver.c | 3 +-- src/qemu/qemu_process.c | 3 +-- 7 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fc785b188b..9116b28360 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14142,12 +14142,10 @@ virDomainChrTargetTypeToString(int deviceType, return type; } =20 -int +void virDomainHostdevInsert(virDomainDef *def, virDomainHostdevDef *hostdev) { VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, hostdev); - - return 0; } =20 virDomainHostdevDef * @@ -14563,9 +14561,8 @@ virDomainDiskRemoveByName(virDomainDef *def, const = char *name) int virDomainNetInsert(virDomainDef *def, virDomainNetDef *net) { /* hostdev net devices must also exist in the hostdevs array */ - if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && - virDomainHostdevInsert(def, &net->data.hostdev.def) < 0) - return -1; + if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) + virDomainHostdevInsert(def, &net->data.hostdev.def); =20 VIR_APPEND_ELEMENT(def->nets, def->nnets, net); return 0; @@ -18931,10 +18928,8 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt, * where the actual network type is already known to be * hostdev) must also be in the hostdevs array. */ - if (virDomainNetGetActualType(net) =3D=3D VIR_DOMAIN_NET_TYPE_HOST= DEV && - virDomainHostdevInsert(def, virDomainNetGetActualHostdev(net))= < 0) { - return NULL; - } + if (virDomainNetGetActualType(net) =3D=3D VIR_DOMAIN_NET_TYPE_HOST= DEV) + virDomainHostdevInsert(def, virDomainNetGetActualHostdev(net)); } VIR_FREE(nodes); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6a6f88e5af..f3d32fe40c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3902,7 +3902,7 @@ virDomainNetDef *virDomainNetRemove(virDomainDef *def= , size_t i); virDomainNetDef *virDomainNetRemoveByObj(virDomainDef *def, virDomainNetDe= f *net); void virDomainNetRemoveHostdev(virDomainDef *def, virDomainNetDef *net); =20 -int virDomainHostdevInsert(virDomainDef *def, virDomainHostdevDef *hostdev= ); +void virDomainHostdevInsert(virDomainDef *def, virDomainHostdevDef *hostde= v); virDomainHostdevDef * virDomainHostdevRemove(virDomainDef *def, size_t i); int virDomainHostdevFind(virDomainDef *def, virDomainHostdevDef *match, diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index cd24eb58d6..6a14d48d3d 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -996,8 +996,7 @@ libxlNetworkPrepareDevices(virDomainDef *def) */ virDomainHostdevDef *hostdev =3D virDomainNetGetActualHostdev(= net); =20 - if (virDomainHostdevInsert(def, hostdev) < 0) - return -1; + virDomainHostdevInsert(def, hostdev); } } =20 diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 6c843b9054..f8ef3f2688 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3584,8 +3584,7 @@ libxlDomainAttachDeviceConfig(virDomainDef *vmdef, vi= rDomainDeviceDef *dev) return -1; } =20 - if (virDomainHostdevInsert(vmdef, hostdev) < 0) - return -1; + virDomainHostdevInsert(vmdef, hostdev); dev->data.hostdev =3D NULL; break; =20 diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index c281998652..b2e04dc532 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -3023,8 +3023,7 @@ lxcDomainAttachDeviceConfig(virDomainDef *vmdef, _("device is already in the domain configuratio= n")); return -1; } - if (virDomainHostdevInsert(vmdef, hostdev) < 0) - return -1; + virDomainHostdevInsert(vmdef, hostdev); dev->data.hostdev =3D NULL; ret =3D 0; break; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 448e6b1591..90b965b5fa 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6722,8 +6722,7 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef, _("device is already in the domain configuratio= n")); return -1; } - if (virDomainHostdevInsert(vmdef, hostdev)) - return -1; + virDomainHostdevInsert(vmdef, hostdev); dev->data.hostdev =3D NULL; break; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3563ad215c..5e20b4a747 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5755,8 +5755,7 @@ qemuProcessPrepareDomainNetwork(virDomainObj *vm) if (qemuDomainPrepareHostdev(hostdev, priv) < 0) return -1; =20 - if (virDomainHostdevInsert(def, hostdev) < 0) - return -1; + virDomainHostdevInsert(def, hostdev); } } return 0; --=20 2.34.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org